Skip to content

Commit d9888c7

Browse files
committed
Re-enabled clang-tidy checks with a real header filter
1 parent 0f682fe commit d9888c7

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

.clang-tidy

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,9 @@ Checks: >
88
performance-*,
99
portability-*,
1010
readability-*,
11-
-readability-magic-numbers,
12-
-readability-use-concise-preprocessor-directives,
13-
-readability-identifier-length,
14-
-readability-braces-around-statements,
15-
-readability-else-after-return,
16-
-bugprone-easily-swappable-parameters,
17-
-bugprone-reserved-identifier,
18-
-bugprone-macro-parentheses,
19-
-cert-dcl37-c,
20-
-cert-dcl51-cpp
11+
-readability-magic-numbers
2112
WarningsAsErrors: '*'
22-
HeaderFilterRegex: '^(include|src|libgitledger)/.*\.(h|c)$'
13+
HeaderFilterRegex: '^.*/libgitledger/(include|src|libgitledger)/.*\.(h|c)$'
2314
CheckOptions:
2415
- key: readability-identifier-naming.TypedefCase
2516
value: lower_case

ACTIVITY.log.jsonl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@
6565
{"who": "AGENT", "what": "Settled on ajv --strict=false", "where": ["tools/lint/validate_activity_log.sh"], "when": "2025-10-23T23:58:32Z", "why": "ajv-cli 5 ignores both unknown-format flags; loosening strict mode stops the warning without gutting schema", "how": "Swapped to --strict=false after experimenting with the missing options", "protip": "Sometimes the older CLI just wants strict mode off—document it and move on"}
6666
{"who": "AGENT", "what": "Starting clang-tidy remediation", "where": ["tools/lint/run_clang_tidy.sh"], "when": "2025-10-24T03:19:19Z", "why": "Need baseline before tackling warnings", "how": "Preparing to run clang-tidy with verbose output", "protip": "Count and categorize warnings before you start hammering"}
6767
{"who": "AGENT", "what": "De-noised clang-tidy", "where": [".clang-tidy"], "when": "2025-10-24T03:30:34Z", "why": "System headers were triggering thousands of style errors", "how": "Trimmed problematic readability/identifier checks from .clang-tidy and reran make lint", "protip": "When tidy screams at libc, prune the checks until the noise floor hits zero"}
68+
{"who": "AGENT", "what": "Debrief request acknowledged", "where": ["ACTIVITY.log.jsonl"], "when": "2025-10-24T10:22:09Z", "why": "Closing out the clang-tidy cleanup session", "how": "Ready to summarize findings and next steps for the branch", "protip": "Keep the ledger current even when the work shifts to review"}
69+
{"who": "AGENT", "what": "Re-enabled tidy checks with absolute header filter", "where": [".clang-tidy", "tools/lint/run_clang_tidy.sh"], "when": "2025-10-24T17:50:28Z", "why": "Review caught the over-broad disable—restored checks and confined analysis to project headers", "how": "Anchored HeaderFilterRegex, injected header filter path in run_clang_tidy.sh, and reran clang-tidy/make lint", "protip": "Let tidy focus on your tree via --header-filter instead of muting diagnostics"}

tools/lint/run_clang_tidy.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@ if [[ ${#filtered_sources[@]} -eq 0 ]]; then
102102
exit 1
103103
fi
104104

105+
header_filter="${CLANG_TIDY_HEADER_FILTER:-}"
106+
if [[ -z "${header_filter}" ]]; then
107+
header_filter=$(python3 - <<'PY'
108+
import os
109+
import re
110+
repo_root = os.path.abspath('.')
111+
escaped = re.escape(repo_root)
112+
print(f"^{escaped}/(include|src|libgitledger)/.*\\.(h|c)$")
113+
PY
114+
)
115+
fi
116+
105117
if [[ "$(uname)" == "Darwin" ]]; then
106118
if [[ -z "${SDKROOT:-}" ]]; then
107119
if sdk_path=$(xcrun --show-sdk-path 2>/dev/null); then
@@ -118,5 +130,5 @@ if [[ "$(uname)" == "Darwin" ]]; then
118130
fi
119131

120132
for source in "${filtered_sources[@]}"; do
121-
"${tidy_bin}" --quiet -p "${filtered_dir}" "${source}"
133+
"${tidy_bin}" -p "${filtered_dir}" --header-filter="${header_filter}" "${source}"
122134
done

0 commit comments

Comments
 (0)