lint/strict/cpp
clang-tidy findings fail the build
Implements lint/strict for cpp.
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | cpp |
| Scope | each |
| Kind | expr |
| Source | library v0.5.0 |
| Selected by | fleetlint-recommended@v0.5.0 |
Requirement
The nearest .clang-tidy sets WarningsAsErrors (for example '*'), so a finding fails the build instead of scrolling past.
Why
clang-tidy reports warnings and exits 0; without WarningsAsErrors its findings never stop a merge.
Applies when
["", "../", "../../", "../../../"].exists(d, file(d + ".clang-tidy"))Check
[["", "../", "../../", "../../../"].map(d, d + ".clang-tidy").filter(f, file(f))] .exists(l, [yaml(l[0])].exists(y, y != null && "WarningsAsErrors" in y && y.WarningsAsErrors != null
&& string(y.WarningsAsErrors).trim() != "" && !string(y.WarningsAsErrors).trim().matches("^-\\*$")))Fix
Set WarningsAsErrors: '*' in .clang-tidy.
Agent instruction: Set WarningsAsErrors: ‘*’ in .clang-tidy and fix the findings that now fail instead of narrowing the check list.
A finding of this rule points at .clang-tidy.
Sources
- https://fleetlint.org/baseline/#static-analysis (convention)
- https://clang.llvm.org/extra/clang-tidy/ (spec)
- https://fleetlint.org/stacks/#cc
Generated by fleetlint docs from catalog v0.5.0.