diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-29 03:11:45 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-29 03:11:45 -0500 |
| commit | c30c38a4e5a8ecc35640e45b27723c199e1d0ade (patch) | |
| tree | 874e1dbaf53563b54692578e756c25329794addb | |
| parent | bbec160f2279f203b98f4aead3c74515224e9988 (diff) | |
| download | dotemacs-c30c38a4e5a8ecc35640e45b27723c199e1d0ade.tar.gz dotemacs-c30c38a4e5a8ecc35640e45b27723c199e1d0ade.zip | |
chore(hooks): skip out-of-tree .el files in validate-el.sh
This PostToolUse hook validates .el edits via check-parens and byte-compile-file. It was firing on edits to files outside the project root too, which meant byte-compiling without the foreign package's load-path set up and leaving .elc droppings in the wrong tree. Added a four-line PROJECT_ROOT guard so out-of-tree files exit silently.
| -rwxr-xr-x | .claude/hooks/validate-el.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/.claude/hooks/validate-el.sh b/.claude/hooks/validate-el.sh index 803badf8..b811bcc2 100755 --- a/.claude/hooks/validate-el.sh +++ b/.claude/hooks/validate-el.sh @@ -35,6 +35,13 @@ f="$(jq -r '.tool_input.file_path // .tool_response.filePath // empty')" [ -z "$f" ] && exit 0 [ "${f##*.}" = "el" ] || exit 0 +# Only validate in-tree files. Files outside PROJECT_ROOT are owned by +# their own project's hooks (when a Claude session runs there). +case "$f" in + "$PROJECT_ROOT"/*) ;; # in-tree, continue + *) exit 0 ;; # out-of-tree, skip +esac + MAX_AUTO_TEST_FILES=20 # skip if more matches than this (large test suites) # --- Phase 1: syntax + byte-compile --- |
