Skip to content

Commit e17f76d

Browse files
authored
Merge pull request #10813 from oharboe/fix-lint-git-arg
bazel: pass git to lint scripts in fix_lint
2 parents cba25e9 + e72a1c9 commit e17f76d

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ sh_binary(
666666
"$(rootpath @buildifier_prebuilt//:buildifier)",
667667
"$(rootpath //bazel:bzl_lint_test.sh)",
668668
"$(rootpath @buildifier_prebuilt//:buildifier)",
669+
"$(rootpath @git)",
669670
],
670671
data = [
671672
"MODULE.bazel",
@@ -677,5 +678,6 @@ sh_binary(
677678
"//bazel:tclfmt",
678679
"//bazel:tclint",
679680
"@buildifier_prebuilt//:buildifier",
681+
"@git",
680682
],
681683
)

bazel/fix_lint.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,27 @@
66
# that file-discovery logic is not duplicated (DRY).
77
set -euo pipefail
88

9+
TCL_TIDY_SH="$1"
10+
TCLFMT="$2"
11+
TCL_LINT_SH="$3"
12+
TCLINT="$4"
13+
BZL_TIDY_SH="$5"
14+
BZL_FMT_BUILDIFIER="$6"
15+
BZL_LINT_SH="$7"
16+
BZL_LINT_BUILDIFIER="$8"
17+
GIT="$9"
18+
919
export BUILD_WORKSPACE_DIRECTORY="${BUILD_WORKSPACE_DIRECTORY:-$PWD}"
1020

1121
# TCL: auto-format then lint
12-
"$1" "$2"
13-
"$3" "$4" || rc=$?
22+
"${TCL_TIDY_SH}" "${TCLFMT}"
23+
"${TCL_LINT_SH}" "${TCLINT}" "${GIT}" || rc=$?
1424

1525
# Bazel: auto-format then lint
16-
"$5" "$6"
17-
"$7" "$8" || rc=$?
26+
"${BZL_TIDY_SH}" "${BZL_FMT_BUILDIFIER}"
27+
"${BZL_LINT_SH}" "${BZL_LINT_BUILDIFIER}" "${GIT}" || rc=$?
1828

19-
git -C "$BUILD_WORKSPACE_DIRECTORY" status
29+
"${GIT}" -C "$BUILD_WORKSPACE_DIRECTORY" status
2030

2131
if [ "${rc:-0}" -ne 0 ]; then
2232
echo "Error: lint violations remain that require manual fixes." >&2

0 commit comments

Comments
 (0)