From 61cd993e540384fd7600e397b9b953166853ed03 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Thu, 30 Apr 2026 20:50:32 +0100 Subject: [PATCH] fix(githooks): skip bash linting on non-bash nomarchy-* scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nomarchy-* prefix is a name convention, not a language guarantee: nomarchy-haptic-touchpad is Python. Without a shebang filter, the pre-commit hook would run `bash -n` on it and abort every commit that touched the Python helper. Filter to scripts whose shebang matches `bash` before linting; everything else passes through. Found via the set -e sweep (1e94818) — the survey caught nomarchy-haptic-touchpad as a "broken" bash script when it was just non-bash. Co-Authored-By: Claude Opus 4.7 --- .githooks/pre-commit | 4 ++++ 1 file changed, 4 insertions(+) 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