diff --git a/.githooks/pre-commit b/.githooks/pre-commit index a454fdc..1232c3c 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -28,6 +28,10 @@ changed_scripts=$(git diff --cached --name-only --diff-filter=ACMR \ if [[ -n "$changed_scripts" ]]; then while IFS= read -r script; do [[ -f "$script" ]] || continue + # Only lint scripts with a bash shebang. nomarchy-* is a name + # convention, not a language guarantee — at least one Python helper + # ships under the same prefix (nomarchy-haptic-touchpad). + head -1 "$script" | grep -qE '^#!.*\bbash\b' || continue if ! bash -n "$script"; then echo "pre-commit: bash syntax error in $script — aborting commit." >&2 exit 1