mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-27 06:53:11 +08: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>
47 lines
1.3 KiB
Bash
Executable File
47 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# lint.sh — Run all linters (clang-tidy + cppcheck + clang-format).
|
|
#
|
|
# Usage:
|
|
# scripts/lint.sh # All 3 linters
|
|
# scripts/lint.sh CLANG_FORMAT=clang-format-20 # Override formatter
|
|
# scripts/lint.sh --ci # CI mode (skip clang-tidy)
|
|
#
|
|
# This script is the SINGLE source of truth for linting.
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
# shellcheck source=env.sh
|
|
source "$ROOT/scripts/env.sh"
|
|
|
|
# Check for --ci flag (skip clang-tidy for platforms without it)
|
|
CI_ONLY=false
|
|
MAKE_ARGS=()
|
|
for arg in "$@"; do
|
|
if [ "$arg" = "--ci" ]; then
|
|
CI_ONLY=true
|
|
else
|
|
MAKE_ARGS+=("$arg")
|
|
fi
|
|
done
|
|
|
|
print_env "lint.sh"
|
|
|
|
# No-skips policy: every test must pass or fail. The only tolerable skip is a
|
|
# genuinely platform-specific test (SKIP_PLATFORM / #ifdef). Runs in both modes.
|
|
echo "=== no-skips policy (tests pass or fail) ==="
|
|
bash "$ROOT/scripts/check-no-test-skips.sh"
|
|
|
|
if $CI_ONLY; then
|
|
echo "=== CI mode: cppcheck + clang-format ==="
|
|
make -j2 -f Makefile.cbm lint-ci "${MAKE_ARGS[@]+"${MAKE_ARGS[@]}"}"
|
|
echo "=== CI linters passed ==="
|
|
else
|
|
echo "=== Full lint: clang-tidy + cppcheck + clang-format ==="
|
|
make -j3 -f Makefile.cbm lint "${MAKE_ARGS[@]+"${MAKE_ARGS[@]}"}"
|
|
fi
|
|
|
|
echo "=== All linters passed ==="
|