aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan R Abrahams-Whitehead <ajordanr@google.com>2022-10-15 00:08:34 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-15 00:58:46 +0000
commite1d62e60dec52b016e5ad9d543d9de2eae0158f6 (patch)
treec9144cc6b7adf7ae4f187a65b7dd2db82a84eff4
parentbe528176c1b17e5e296922eefd80c34506d3312c (diff)
downloadtoolchain-utils-e1d62e60dec52b016e5ad9d543d9de2eae0158f6.tar.gz
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>
-rwxr-xr-xtoolchain_utils_githooks/check-presubmit.py5
1 files 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: "