ci(clang-tidy): switch to high-signal whitelist (CoolProp-2uw)#2802
Merged
Conversation
Tune .clang-tidy from `Checks: *, -<dropped>` (everything-minus) to a
positive whitelist of bug-finding + modernization + perf categories.
The clang-tidy CI workflow is informational-only, so this config
defines what gets surfaced as "interesting" in the artifact.
Empirical noise survey on representative src/ files (rerun after the
change to validate):
src/CPstrings.cpp:
BEFORE: 5+ warnings — misc-include-cleaner, misc-use-internal-linkage,
readability-isolate-declaration, readability-braces-around-
statements, modernize-use-emplace
AFTER: 1 warning — modernize-use-emplace (auto-fixable)
src/Solvers.cpp:
BEFORE: 15+ warnings dominated by misc-include-cleaner cascades
on Eigen::*, std::*, _HUGE, root_sum_square, etc.
AFTER: 30 warnings, all signal:
- 27 cppcoreguidelines-init-variables (real UB risk —
uninitialized doubles at solver entry points lines
14, 109, 160, ...)
- 2 performance-avoid-endl
- 1 modernize-deprecated-headers (math.h → cmath)
Whitelist categories:
bugprone-*, cert-*, clang-analyzer-*, cppcoreguidelines-*,
modernize-*, performance-*,
readability-implicit-bool-conversion (catches checks like 'if (n)'
when n is integer; pointer-conditions are already opt-in via
AllowPointerConditions=true), and the project's hicpp-* survivors.
Dropped categories (high noise on this codebase):
misc-* (include-cleaner, const-correctness, use-internal-linkage)
readability-* (isolate-declaration, braces-around-statements,
use-concise-preprocessor-directives, etc.)
portability-*, boost-*, fuchsia-*, google-*, etc.
Existing per-check suppressions (accumulated project knowledge:
narrowing-conversions noise, override macros, Qt raw pointers, Google
Test global vars) are preserved verbatim within the whitelisted
categories.
CheckOptions cleaned: dropped dead options for now-disabled checks
(modernize-use-override.*, cppcoreguidelines-narrowing-conversions.*,
misc-non-private-member-variables-in-classes.*).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tighten
.clang-tidyfromChecks: '*, -<dropped>'(everything-minus) to a positive whitelist of bug-finding + modernization + perf categories. The clang-tidy CI workflow is informational-only (per #2801), so this config defines what gets surfaced as "interesting" in the artifact — and previously most of it was style noise.Empirical before/after on representative src/ files
Same docker run as the survey for #2801, this time with the new config:
src/CPstrings.cppsrc/Solvers.cppThe 27×
cppcoreguidelines-init-variablescluster is at solver entry points (lines 14, 109, 160, …) — uninitialized doubles in numerical code can cause non-deterministic results. Real signal.Whitelist categories
bugprone-*,cert-*,clang-analyzer-*,cppcoreguidelines-*modernize-*,performance-*readability-implicit-bool-conversion(catchesif (n)for integern; pointer conditions already allowed via existing CheckOption)hicpp-*survivors (exception-baseclass, multiway-paths-covered, no-assembler, signed-bitwise)Dropped categories (high noise on this codebase)
misc-*— include-cleaner, const-correctness, use-internal-linkagereadability-*(except implicit-bool-conversion) — isolate-declaration, braces-around-statements, use-concise-preprocessor-directives, etc.portability-*,boost-*,fuchsia-*,google-*,zircon-*,abseil-*,llvm*,altera*— irrelevant or noisePreserved
All existing per-check suppressions (narrowing-conversions noise, override macros, Qt raw pointers, Google Test global vars) are preserved verbatim within the whitelisted categories. Long-standing project knowledge stays intact.
Cleaned up
Dropped dead
CheckOptionsfor now-disabled checks:modernize-use-override.*,cppcoreguidelines-narrowing-conversions.*,misc-non-private-member-variables-in-classes.*.Test plan
Related
2uw.6, manual-stage clang-tidy pre-commit hook)🤖 Generated with Claude Code