From 42d20ed28e5f3a839c6afc8640640850ea910727 Mon Sep 17 00:00:00 2001 From: UebelAndre Date: Wed, 2 Oct 2024 19:14:39 -0700 Subject: [PATCH] Check target tags before ignore tags for lint/fmt aspects --- rust/private/clippy.bzl | 9 +++++---- rust/private/rustfmt.bzl | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/rust/private/clippy.bzl b/rust/private/clippy.bzl index 748f33a014..9d5e6ddb69 100644 --- a/rust/private/clippy.bzl +++ b/rust/private/clippy.bzl @@ -75,12 +75,12 @@ def _get_clippy_ready_crate_info(target, aspect_ctx = None): # Targets with specific tags will not be formatted if aspect_ctx: ignore_tags = [ + "no_clippy", + "no_lint", "noclippy", - "no-clippy", ] - - for tag in ignore_tags: - if tag in aspect_ctx.rule.attr.tags: + for tag in aspect_ctx.rule.attr.tags: + if tag.replace("-", "_").lower() in ignore_tags: return None # Obviously ignore any targets that don't contain `CrateInfo` @@ -192,6 +192,7 @@ def _clippy_aspect_impl(target, ctx): tools = [toolchain.clippy_driver], arguments = args.all, mnemonic = "Clippy", + progress_message = "Clippy %{label}", toolchain = "@rules_rust//rust:toolchain_type", ) diff --git a/rust/private/rustfmt.bzl b/rust/private/rustfmt.bzl index a47b10fee0..036082ef49 100644 --- a/rust/private/rustfmt.bzl +++ b/rust/private/rustfmt.bzl @@ -38,13 +38,13 @@ def _find_rustfmtable_srcs(crate_info, aspect_ctx = None): # Targets with specific tags will not be formatted if aspect_ctx: ignore_tags = [ - "no-format", - "no-rustfmt", + "no_format", + "no_rustfmt", "norustfmt", ] - for tag in ignore_tags: - if tag in aspect_ctx.rule.attr.tags: + for tag in aspect_ctx.rule.attr.tags: + if tag.replace("-", "_").lower() in ignore_tags: return [] # Filter out any generated files @@ -92,6 +92,7 @@ def _perform_check(edition, srcs, ctx): tools = [rustfmt_toolchain.all_files], arguments = [args], mnemonic = "Rustfmt", + progress_message = "Rustfmt %{label}", ) return marker