Files
deusdata--codebase-memory-mcp/scripts/lint.sh
T
wehub-resource-sync 41cb1c0170
OpenSSF Scorecard / scorecard (push) Failing after 0s
DCO / dco (push) Failing after 0s
CodeQL SAST / analyze (push) Failing after 1s
Deploy Pages / deploy (push) Failing after 1s
chore: import upstream snapshot with attribution
2026-07-13 12:28:05 +08:00

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 ==="