Add explanatory comments to all test scripts
This commit is contained in:
@@ -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 ]
|
||||
|
||||
Reference in New Issue
Block a user