Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -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-*,
Expand All @@ -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,
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.)"; \
Expand Down