Add explanatory comments to all test scripts

This commit is contained in:
2026-06-02 23:36:18 +01:00
parent fe8744e20e
commit 34b2515fca
5 changed files with 61 additions and 13 deletions
+4
View File
@@ -4,8 +4,10 @@ set -euo pipefail
pass=0
fail=0
# Allow overriding shellcheck options via env var (e.g. -s bash)
EXTRA_SHELLCHECK_OPTS="${SHELLCHECK_OPTS:-}"
# Run shellcheck on a Go template after stripping template tags
shellcheck_tmpl() {
local tmpl=$1
# Strip Go template tags ({{ ... }} and {{- ... -}}) into whitespace
@@ -28,10 +30,12 @@ shellcheck_tmpl() {
}
echo "=== ShellCheck ==="
# Lint each template file passed as argument
for f in "$@"; do
[ -f "$f" ] && shellcheck_tmpl "$f"
done
echo "---"
echo "Passed: $pass Failed: $fail"
# Exit with failure if any template failed shellcheck
[ "$fail" -eq 0 ]