Skip to content

Commit 7b2e905

Browse files
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

File tree

.clang-tidy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
Checks: 'redpanda-*,clang-diagnostic-*,clang-analyzer-*,cert-*,cppcoreguidelines-*,hicpp-*,modernize-*,performance-*,misc-*,bugprone-*,-modernize-use-trailing-return-type,-modernize-use-nodiscard,-hicpp-named-parameter,-misc-include-cleaner,-clang-analyzer-optin.core.EnumCastOutOfRange,-cppcoreguidelines-avoid-reference-coroutine-parameters'
33
WarningsAsErrors: 'redpanda-*,bugprone-use-after-move,bugprone-assert-side-effect,bugprone-assignment-in-if-condition,bugprone-dangling-handle,bugprone-sizeof-container,bugprone-stringview-nullptr,bugprone-unused-return-value,bugprone-suspicious-string-compare,misc-unused-using-decls,misc-unused-alias-decls,modernize-redundant-void-arg,performance-implicit-conversion-in-loop,performance-trivially-destructible,performance-no-automatic-move,performance-move-const-arg,bugprone-unused-local-non-trivial-variable'
4-
HeaderFilterRegex: '^(?!external/.*).*'
4+
HeaderFilterRegex: '.*'
5+
ExcludeHeaderFilterRegex: '(^|/)external/|\.json\.hh$'
56
FormatStyle: file
67
CheckOptions:
78
- key: cert-dcl16-c.NewSuffixes

0 commit comments

Comments
 (0)