Skip to content

Commit 97b5c61

Browse files
LarsMichelsenJenkins
authored andcommitted
astrein: silence file count in Bazel aspect runs
The "Checking N python files" stderr message caused an "INFO: From Linting" block per target in CI logs. Print it only when no --output file is given (interactive use). Change-Id: I3eafed0b2e9ae0acbee05cdac66bd7b254ed4299
1 parent b6f2f94 commit 97b5c61

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • packages/cmk-astrein/cmk/astrein

packages/cmk-astrein/cmk/astrein/cli.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ def main() -> int:
7070
sys.stderr.write(f"{e}\n")
7171
return 1
7272

73+
# Keep interactive runs informative, but stay quiet when writing to an
74+
# output file (Bazel aspect), where this would spam the build log.
75+
if args.output is None:
76+
sys.stderr.write(f"Checking {len(files_to_check)} python files\n")
77+
7378
return _handle_results(
7479
_run_checkers(files_to_check, workspace_dir, factories),
7580
args.format,
@@ -135,10 +140,7 @@ def _collect_files(paths: Sequence[Path], workspace_dir: Path) -> list[Path]:
135140
else:
136141
raise ValueError(f"Error: Not a file or directory: {path}")
137142

138-
files_to_check = sorted(set(files_to_check))
139-
sys.stderr.write(f"Checking {len(files_to_check)} python files\n")
140-
141-
return files_to_check
143+
return sorted(set(files_to_check))
142144

143145

144146
@dataclass

0 commit comments

Comments
 (0)