Skip to content

Commit 1ddf762

Browse files
author
endolinbot
committed
fix(scripts/checks): widen bench-engines-rename exclusion to the runner index and test (#3)
The gate's check.sh excluded only its own subdirectory, but two other in-tree paths legitimately name the antipattern by example: the runner index at scripts/checks/README.md (which lists installed gates including this one) and the smoke test at tests/checks/test_bench_engines_rename.sh (which has to write a fixture containing the literal string to verify the gate fires). Without this widening the gate fires on its own infrastructure on every run. The exclusion is targeted: only the runner index and the matching test file are spared; any other file carrying ".bench-engines" is still an offender. The narrowness keeps the gate's blast radius intact. Followup also adds a fallback grep --exclude for the same paths, exercised when the script runs outside a git repo.
1 parent f82fda0 commit 1ddf762

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

  • scripts/checks/bench-engines-rename

scripts/checks/bench-engines-rename/check.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
# GATE_REPO_ROOT the directory to scan (default: $PWD).
1212
#
1313
# Output: prints matching lines to stderr. Exits 0 if clean, 1 if any
14-
# match is found. Excludes the gate's own files (this directory) so
15-
# the documentation that names the antipattern does not trigger.
14+
# match is found. Excludes the gate's own files plus the infrastructure
15+
# that names the antipattern by example (the runner index, the
16+
# corresponding test suite). Anything else carrying the string is a
17+
# genuine offender.
1618

1719
set -uo pipefail
1820

@@ -21,16 +23,24 @@ test -d "$REPO_ROOT" || { echo "bench-engines-rename: REPO_ROOT not a directory:
2123

2224
cd "$REPO_ROOT" || { echo "bench-engines-rename: cd failed: $REPO_ROOT" >&2; exit 2; }
2325

24-
# Use git grep when inside a repo (faster, respects .gitignore); fall
25-
# back to a recursive grep when not. Both surface filename:line:text.
26-
exclude_self=":!scripts/checks/bench-engines-rename/"
26+
# Infrastructure that legitimately names the antipattern. Adding to
27+
# this list is a judgment call: the legitimate-mention files are the
28+
# gate's own subdirectory, the runner index that lists installed gates,
29+
# and the smoke-test file. Anywhere else, the string is an offender.
30+
EXCLUDE_PATHS=(
31+
":!scripts/checks/bench-engines-rename/"
32+
":!scripts/checks/README.md"
33+
":!tests/checks/test_bench_engines_rename.sh"
34+
)
2735

2836
if git rev-parse --git-dir >/dev/null 2>&1; then
29-
hits=$(git grep -nF '.bench-engines' -- "$exclude_self" 2>/dev/null || true)
37+
hits=$(git grep -nF '.bench-engines' -- "${EXCLUDE_PATHS[@]}" 2>/dev/null || true)
3038
else
3139
hits=$(grep -RnF --exclude-dir=.git \
3240
--exclude-dir=node_modules \
3341
--exclude-dir=scripts/checks/bench-engines-rename \
42+
--exclude="README.md" \
43+
--exclude="test_bench_engines_rename.sh" \
3444
'.bench-engines' . 2>/dev/null || true)
3545
fi
3646

0 commit comments

Comments
 (0)