diff --git a/.clang-tidy b/.clang-tidy index ecc6b8e..999e4c6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,7 +1,15 @@ --- # Configuration for clang-tidy +# Use a focused set of checks instead of * to improve performance Checks: > - *, + bugprone-*, + cppcoreguidelines-*, + modernize-*, + performance-*, + readability-*, + cert-*, + clang-analyzer-*, + misc-*, -abseil-*, -altera-*, -android-*, @@ -20,7 +28,6 @@ Checks: > -cppcoreguidelines-avoid-c-arrays, -cppcoreguidelines-pro-bounds-constant-array-index, -cppcoreguidelines-pro-bounds-array-to-pointer-decay, - -hicpp-no-array-decay, -cppcoreguidelines-avoid-magic-numbers, -readability-magic-numbers, -cert-err34-c, @@ -33,8 +40,8 @@ Checks: > -bugprone-exception-escape, -cppcoreguidelines-avoid-const-or-ref-data-members -# Exclude Google Test and external dependencies from analysis -HeaderFilterRegex: "^(?!.*(gtest|googletest|gmock|third_party|external|vendor|/opt/homebrew/)).*" +# Only analyze our source files, not system headers or external dependencies +HeaderFilterRegex: "^(problems|common)/.*\\.(h|cc)$" CheckOptions: - key: readability-identifier-naming.NamespaceCase diff --git a/Makefile b/Makefile index f13346a..6d59000 100644 --- a/Makefile +++ b/Makefile @@ -208,10 +208,9 @@ lint: lint-cpp: @echo "Linting C++ files..." @if command -v clang-tidy >/dev/null; then \ - find $(PROBLEMS_DIR) $(COMMON_DIR) -type f \( -name '*.cc' -o -name '*.h' \) | while read -r file; do \ - clang-tidy "$$file" --config-file=.clang-tidy --quiet -- $(CXXFLAGS) -x c++ 2>&1 | \ - grep -v "warnings generated\|Suppressed.*warnings\|Use -header-filter\|Use -system-headers" || true; \ - done; \ + find $(PROBLEMS_DIR) $(COMMON_DIR) -type f \( -name '*.cc' -o -name '*.h' \) -print0 | \ + xargs -0 -P 4 -I {} clang-tidy {} --config-file=.clang-tidy --quiet --header-filter="^(problems|common)/.*\\.(h|cc)$$" -- $(CXXFLAGS) -x c++ 2>/dev/null | \ + grep -E "^[^:]+:[0-9]+:[0-9]+:" || true; \ echo "$(call color_green,C++ linting complete.)"; \ else \ echo "$(call color_red,clang-tidy not found. Please install it to lint C++ files.)"; \