From e1d62e60dec52b016e5ad9d543d9de2eae0158f6 Mon Sep 17 00:00:00 2001 From: Jordan R Abrahams-Whitehead Date: Sat, 15 Oct 2022 00:08:34 +0000 Subject: toolchain_utils_githooks: Add line-length to black This fixes the autofix command so that we enforce a line length of 80 chars. BUG=None TEST=Checked presubmit on violating file Change-Id: If8817cdf9ab70d5d9e5db10c0818207f976f519c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3958135 Reviewed-by: George Burgess Auto-Submit: Jordan Abrahams-Whitehead Tested-by: Jordan Abrahams-Whitehead Commit-Queue: Jordan Abrahams-Whitehead --- toolchain_utils_githooks/check-presubmit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/toolchain_utils_githooks/check-presubmit.py b/toolchain_utils_githooks/check-presubmit.py index 29744aaf..485737d5 100755 --- a/toolchain_utils_githooks/check-presubmit.py +++ b/toolchain_utils_githooks/check-presubmit.py @@ -187,7 +187,8 @@ def check_black( ) black_version = stdout_and_stderr.strip() - command = [black, "--line-length=80", "--check"] + python_files + black_invocation: t.List[str] = [str(black), "--line-length=80"] + command = black_invocation + ["--check"] + list(python_files) exit_code, stdout_and_stderr = run_command_unchecked( command, cwd=toolchain_utils_root ) @@ -238,7 +239,7 @@ def check_black( autofix_commands=[], ) - autofix = [black] + bad_files + autofix = black_invocation + bad_files return CheckResult( ok=False, output=f"Using {black_version!r}, these file(s) have formatting errors: " -- cgit v1.2.3