hygiene: let the output decide, not xargs' exit status
CI / check (push) Canceled after 0s

`if … | xargs -0 grep` read a match as clean whenever any one batch of
files had none (xargs answers 123) or grep met an error (2). Today every
file fits one batch, so nothing slipped through; it would once the
repository grows. Same form as the server's and the CLI's check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H1bF3XAshtCGhF7TeLGcDk
This commit is contained in:
HomerandClaude Opus 5.5 committed 2026-11-28 00:06:29 +00:00
1 parent 549ce17645
commit cf092ef1a1
1 file changed
+5 -1
+5 -1
View File
@@ -20,7 +20,11 @@ patterns=(
)
found=0
for pattern in "${patterns[@]}"; do
if git ls-files -z | grep -zv '^scripts/hygiene.sh$' | xargs -0 grep -nIEi -- "$pattern" ; then
# The output decides, not the exit status: xargs answers 123 when any one batch of files has no
# match, and grep 2 on an error -- either would have read as "clean" around real matches.
hits=$(git ls-files -z | grep -zv '^scripts/hygiene.sh$' | xargs -0 grep -nIEi -- "$pattern" 2>/dev/null || true)
if [ -n "$hits" ]; then
printf '%s\n' "$hits"
echo "hygiene: the lines above match /$pattern/" >&2
found=1
fi