mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 10:48:20 +00:00
On NixOS (and other non-FHS systems) /bin/bash does not exist, so scripts with an absolute shebang fail to run. Switch the remaining holdouts to /usr/bin/env bash: eleven scripts/*.sh, test-infrastructure/run.sh, and the three Claude Code hook scripts emitted by src/cli/cli.c (gate, session reminder, subagent reminder). Distilled from PR #674, with parser-test coverage preserved: the infra_parse_shell* fixtures in tests/test_pipeline.c intentionally keep #!/bin/bash so absolute-path shebang extraction stays covered, and tests/repro fixtures are untouched. Also replace the GitHub-PAT-shaped fixture string flagged in the #674 thread with an obviously fake placeholder (ghp_FAKE...) that still matches the ghp_ + 36-alnum secret detector. Co-authored-by: Sandro Jäckel <sandro.jaeckel@gmail.com> Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
32 lines
1.0 KiB
Bash
Executable File
32 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Verify NOLINT(misc-no-recursion) only appears on whitelisted functions.
|
|
WHITELIST="src/foundation/recursion_whitelist.h"
|
|
if [ ! -f "$WHITELIST" ]; then
|
|
echo "ERROR: $WHITELIST not found"; exit 1
|
|
fi
|
|
ALLOWED=$(grep -oE '"[a-zA-Z_][a-zA-Z0-9_]*"' "$WHITELIST" | tr -d '"' | sort -u)
|
|
|
|
HITS=$(grep -rn 'NOLINT(misc-no-recursion)' src/ internal/cbm/*.c internal/cbm/*.h 2>/dev/null \
|
|
| grep -v vendored | grep -v recursion_whitelist)
|
|
if [ -z "$HITS" ]; then exit 0; fi
|
|
|
|
FAIL=0
|
|
while IFS= read -r line; do
|
|
FILE=$(echo "$line" | cut -d: -f1)
|
|
LN=$(echo "$line" | cut -d: -f2)
|
|
# Check current line AND 5 lines above for the function name
|
|
CONTEXT=$(sed -n "$((LN > 5 ? LN - 5 : 1)),${LN}p" "$FILE")
|
|
FOUND=0
|
|
for fn in $ALLOWED; do
|
|
if echo "$CONTEXT" | grep -qw "$fn"; then
|
|
FOUND=1; break
|
|
fi
|
|
done
|
|
if [ "$FOUND" -eq 0 ]; then
|
|
echo "ERROR: NOLINT(misc-no-recursion) on non-whitelisted function:"
|
|
echo " $line"
|
|
FAIL=1
|
|
fi
|
|
done <<< "$HITS"
|
|
exit $FAIL
|