fix(gate): close the gaps in the plan-code guard, the button lists and the tooling
- planCodes: the quote and slash lookarounds let the commonest form through (a docstring or test title opening with a code, a slash pair); the two real exceptions (an episode titled "E1", ruff's E4/E7/E9) are now named and cut first, with cases that fail on the old pattern. audit_metrics counts by the same definition. - button-primitive: both file lists live in the rule body, out of sight of the snapshot and the register; each is now pinned to its exact set of ui/ files (red when either is widened). - check.sh --brief shows a short log whole and keeps the line before each hit, so ruff's rule and eslint's file path survive the excerpt. - lint-changed runs prettier over every changed frontend file, as the gate does, not only code. - CLAUDE.md and gates.md no longer claim the basedpyright baseline was found harmless: it was never triaged, and the reportOptional* entries are the likeliest real bugs.
This commit is contained in:
+16
-6
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# The fast lint lanes on the uncommitted files only — ruff (check + format) on Python, eslint +
|
||||
# prettier on the frontend — for a check after every edit instead of a full gate run. It is a
|
||||
# convenience, never the gate: scripts/check.sh stays what a merge or a release requires.
|
||||
# The fast lint lanes on the uncommitted files only — ruff (check + format) on Python, eslint on the
|
||||
# frontend's code and prettier on all of the frontend — for a check after every edit instead of a
|
||||
# full gate run. It is a convenience, never the gate: scripts/check.sh stays what a merge or a
|
||||
# release requires.
|
||||
#
|
||||
# bash scripts/lint-changed.sh lint what `git status` shows as changed or new
|
||||
# bash scripts/lint-changed.sh --hook the same, as a Claude Code Stop hook: silent and exit 0 when
|
||||
@@ -23,12 +24,19 @@ fi
|
||||
|
||||
mapfile -t changed < <(git status --porcelain --untracked-files=all | sed -E 's/^.. //; s/.* -> //' |
|
||||
while read -r f; do [ -f "$f" ] && printf '%s\n' "$f"; done)
|
||||
py=() fe=()
|
||||
# eslint reads code; prettier reads every file the gate's `prettier --check .` does (a locale JSON,
|
||||
# a stylesheet), and `--ignore-unknown` passes over the ones it has no parser for.
|
||||
py=() fe=() pretty=()
|
||||
for f in "${changed[@]}"; do
|
||||
case "$f" in
|
||||
backend/*.py | scripts/*.py) py+=("$f") ;;
|
||||
esac
|
||||
case "$f" in
|
||||
frontend/*.ts | frontend/*.tsx | frontend/*.js | frontend/*.mjs) fe+=("${f#frontend/}") ;;
|
||||
esac
|
||||
case "$f" in
|
||||
frontend/*) pretty+=("${f#frontend/}") ;;
|
||||
esac
|
||||
done
|
||||
|
||||
report="$(
|
||||
@@ -38,12 +46,14 @@ report="$(
|
||||
fi
|
||||
if [ ${#fe[@]} -gt 0 ]; then
|
||||
(cd frontend && npx eslint --max-warnings 0 "${fe[@]}" 2>&1)
|
||||
(cd frontend && npx prettier --check --log-level warn "${fe[@]}" 2>&1)
|
||||
fi
|
||||
if [ ${#pretty[@]} -gt 0 ]; then
|
||||
(cd frontend && npx prettier --check --ignore-unknown --log-level warn "${pretty[@]}" 2>&1)
|
||||
fi
|
||||
)"
|
||||
|
||||
if [ -z "$report" ]; then
|
||||
[ "$hook" = 1 ] || echo "lint-changed: clean (${#py[@]} py, ${#fe[@]} frontend)"
|
||||
[ "$hook" = 1 ] || echo "lint-changed: clean (${#py[@]} py, ${#pretty[@]} frontend)"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$hook" = 1 ]; then
|
||||
|
||||
Reference in New Issue
Block a user