diff options
author | Erik Staats <estaats@google.com> | 2024-03-08 21:56:17 +0000 |
---|---|---|
committer | Matthias Männich <maennich@google.com> | 2024-03-13 23:31:07 +0000 |
commit | 9834bd7f228c7cdb35cca3af09c3910cfd55096b (patch) | |
tree | d4a1d7960c5f2de7be06a137a9b71270679b29c1 | |
parent | 1cf2b2b5fb5d3978d505486089d791eb772e8836 (diff) | |
download | build-9834bd7f228c7cdb35cca3af09c3910cfd55096b.tar.gz |
kleaf: checkpatch_presubmit: Make full checkpatch log silent
When generating the full checkpatch log, don't output results to stdio.
Bug: 321067108
Test: Verified checkpatch_full.log file is silently generated with all
violations.
Change-Id: I4a82335c3e509964166b60738a5f3d2de4206a02
Signed-off-by: Erik Staats <estaats@google.com>
-rw-r--r-- | static_analysis/checkpatch_presubmit_bazel.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/static_analysis/checkpatch_presubmit_bazel.py b/static_analysis/checkpatch_presubmit_bazel.py index 1a2f5be..0f8fe4d 100644 --- a/static_analysis/checkpatch_presubmit_bazel.py +++ b/static_analysis/checkpatch_presubmit_bazel.py @@ -101,6 +101,7 @@ def _run_checkpatch( git_sha1: str, log: pathlib.Path, checkpatch_args: list[str], + silent: bool = False, ) -> int: args = [_BAZEL, "run", "--show_result=0"] args += _SILENT_ARGS @@ -113,6 +114,8 @@ def _run_checkpatch( args, text=True, cwd=_resolve_against_workspace_root("."), + stdout=subprocess.DEVNULL if silent else None, + stderr=subprocess.STDOUT if silent else None, ).returncode @@ -170,6 +173,7 @@ def main( git_sha1=git_sha1, log=checkpatch_full_log, checkpatch_args=checkpatch_args + ["--ignored_checks", ""], + silent=True, ) success = sum(return_codes) == 0 |