Commit 7b2e905
committed
clang-tidy: Adapt Regex
Multiple issues with the existing header regex:
Problem 1: YAML round-trip corruption. The Python wrapper (clang_tidy.py) loads
the .clang-tidy file with yaml.safe_load, modifies the Checks field, then
writes it back with yaml.safe_dump. The dump produces:
HeaderFilterRegex: ^(?!external/.*).*
Note: no quotes. LLVM's YAML parser sees !external as a YAML tag indicator,
corrupting the regex. This silently disables header filtering — no headers get
checked for WarningsAsErrors violations.
Problem 2: Path mismatch. Even if the regex survived YAML, it anchors at
^external/. But Bazel sandbox paths look like
bazel-out/k8-fastbuild/bin/external/protobuf+/... — they don't start with
external/, so the negative lookahead never triggers.
The new config:
- HeaderFilterRegex: '.*': check diagnostics from all headers -
- ExcludeHeaderFilterRegex: clang-tidy 18+ feature that excludes
matching headers:
- (^|/)external/ — matches external/ anywhere in the path (handles
Bazel's bazel-out/.../external/... paths)
- \.json\.hh$ — excludes Seastar-generated swagger headers
(auto-generated code we can't fix)
Neither value contains !, so they survive YAML round-tripping safely.1 parent b882c9d commit 7b2e905
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
0 commit comments