From 558de9b0fe50ba4581dec795252e97b7199ea9d3 Mon Sep 17 00:00:00 2001 From: Alexandre Velia Date: Thu, 3 Sep 2026 16:29:56 +0400 Subject: [PATCH] chore: local shellcheck gate on edited shell scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Runs the same check the CI shellcheck job runs (-S warning -x, dotfiles/ excluded) on every shell script Claude writes or edits, so a lint failure surfaces at edit time rather than after a push. Exit 2 feeds shellcheck's diagnostic back into the session. No-ops on anything that is not a shell script, and on machines without shellcheck installed — it is a convenience, not a substitute for the CI job, which stays the gate that decides what merges. Co-Authored-By: Claude Opus 5 (1M context) --- .claude/settings.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .claude/settings.json diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..33958e3 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json.schemastore.org/claude-code-settings.json", + "hooks": { + "PostToolUse": [ + { + "matcher": "Write|Edit", + "hooks": [ + { + "type": "command", + "command": "jq -r \"(.tool_response.filePath // .tool_input.file_path) // empty\" | { read -r f || exit 0; case \"$f\" in */dotfiles/*) exit 0 ;; *.sh|*/bootstrap.sh) ;; *) exit 0 ;; esac; command -v shellcheck >/dev/null || exit 0; shellcheck -S warning -x \"$f\" >&2 || exit 2; }", + "timeout": 30, + "statusMessage": "shellcheck" + } + ] + } + ] + } +}