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 <gbiv@chromium.org>
Auto-Submit: Jordan Abrahams-Whitehead <ajordanr@google.com>
Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
diff --git a/toolchain_utils_githooks/check-presubmit.py b/toolchain_utils_githooks/check-presubmit.py
index 29744aa..485737d 100755
--- a/toolchain_utils_githooks/check-presubmit.py
+++ b/toolchain_utils_githooks/check-presubmit.py
@@ -187,7 +187,8 @@
)
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 @@
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: "