From e3a9a30f7e690a2814a78c014d0e248b870e2795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Sat, 4 Jul 2026 15:42:07 +0200 Subject: [PATCH 1/2] bazel: pass git to lint scripts in fix_lint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tcl_lint_test.sh and bzl_lint_test.sh take the git binary as their second argument (as their sh_test wrappers pass it), but //:fix_lint invoked them with only the lint tool, so 'bazelisk run //:fix_lint' always failed with '$2: unbound variable'. Signed-off-by: Øyvind Harboe --- BUILD.bazel | 2 ++ bazel/fix_lint.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 3e9ab569156..656e4129bb4 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -666,6 +666,7 @@ sh_binary( "$(rootpath @buildifier_prebuilt//:buildifier)", "$(rootpath //bazel:bzl_lint_test.sh)", "$(rootpath @buildifier_prebuilt//:buildifier)", + "$(rootpath @git)", ], data = [ "MODULE.bazel", @@ -677,5 +678,6 @@ sh_binary( "//bazel:tclfmt", "//bazel:tclint", "@buildifier_prebuilt//:buildifier", + "@git", ], ) diff --git a/bazel/fix_lint.sh b/bazel/fix_lint.sh index f5faab6084c..df495b2eebd 100755 --- a/bazel/fix_lint.sh +++ b/bazel/fix_lint.sh @@ -10,11 +10,11 @@ export BUILD_WORKSPACE_DIRECTORY="${BUILD_WORKSPACE_DIRECTORY:-$PWD}" # TCL: auto-format then lint "$1" "$2" -"$3" "$4" || rc=$? +"$3" "$4" "$9" || rc=$? # Bazel: auto-format then lint "$5" "$6" -"$7" "$8" || rc=$? +"$7" "$8" "$9" || rc=$? git -C "$BUILD_WORKSPACE_DIRECTORY" status From e72a1c9a8012d49043d8f4849130faf8faff04d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Sat, 4 Jul 2026 18:50:37 +0200 Subject: [PATCH 2/2] bazel: name fix_lint.sh parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review feedback: assign the positional parameters to named variables, matching the style of the per-language lint scripts, and use the passed git for the final status report. Signed-off-by: Øyvind Harboe --- bazel/fix_lint.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/bazel/fix_lint.sh b/bazel/fix_lint.sh index df495b2eebd..d65c38e7aba 100755 --- a/bazel/fix_lint.sh +++ b/bazel/fix_lint.sh @@ -6,17 +6,27 @@ # that file-discovery logic is not duplicated (DRY). set -euo pipefail +TCL_TIDY_SH="$1" +TCLFMT="$2" +TCL_LINT_SH="$3" +TCLINT="$4" +BZL_TIDY_SH="$5" +BZL_FMT_BUILDIFIER="$6" +BZL_LINT_SH="$7" +BZL_LINT_BUILDIFIER="$8" +GIT="$9" + export BUILD_WORKSPACE_DIRECTORY="${BUILD_WORKSPACE_DIRECTORY:-$PWD}" # TCL: auto-format then lint -"$1" "$2" -"$3" "$4" "$9" || rc=$? +"${TCL_TIDY_SH}" "${TCLFMT}" +"${TCL_LINT_SH}" "${TCLINT}" "${GIT}" || rc=$? # Bazel: auto-format then lint -"$5" "$6" -"$7" "$8" "$9" || rc=$? +"${BZL_TIDY_SH}" "${BZL_FMT_BUILDIFIER}" +"${BZL_LINT_SH}" "${BZL_LINT_BUILDIFIER}" "${GIT}" || rc=$? -git -C "$BUILD_WORKSPACE_DIRECTORY" status +"${GIT}" -C "$BUILD_WORKSPACE_DIRECTORY" status if [ "${rc:-0}" -ne 0 ]; then echo "Error: lint violations remain that require manual fixes." >&2