Skip to content

Commit 6f43e6b

Browse files
authored
fix(build): make sa actually fail on shellcheck findings (#815)
1 parent 52750c5 commit 6f43e6b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,18 @@ pre_commit/run:
8989
test/parallel: $(TEST_SCRIPTS)
9090
@bash ./bashunit --parallel --simple $(TEST_SCRIPTS)
9191

92+
# sa: xargs (unlike `find -exec {} \;`) propagates shellcheck's exit code, so
93+
# findings actually fail the target; the excludes mirror the CI workflow's
94+
# SHELLCHECK_OPTS for local/CI parity. One file per invocation (like CI's
95+
# action) because shellcheck 0.11.0 can crash on multi-file batches with -x;
96+
# -P 4 keeps the wall time reasonable.
9297
sa:
9398
ifndef STATIC_ANALYSIS_CHECKER
9499
@printf "\e[1m\e[31m%s\e[0m\n" "Shellcheck not installed: Static analysis not performed!" && exit 1
95100
else
96-
@find . -name "*.sh" -not -path "./local/*" -exec shellcheck -xC {} \; && printf "\e[1m\e[32m%s\e[0m\n" "ShellCheck: OK!"
101+
@find . -name "*.sh" -not -path "./local/*" -print0 \
102+
| xargs -0 -n 1 -P 4 shellcheck -xC -e SC1091 -e SC2155 -e SC2016 \
103+
&& printf "\e[1m\e[32m%s\e[0m\n" "ShellCheck: OK!"
97104
endif
98105

99106
lint:

0 commit comments

Comments
 (0)