Skip to content

ci(clang-tidy): switch to high-signal whitelist (CoolProp-2uw)#2802

Merged
ibell merged 1 commit into
masterfrom
ib/clangtidy-high-signal
Apr 26, 2026
Merged

ci(clang-tidy): switch to high-signal whitelist (CoolProp-2uw)#2802
ibell merged 1 commit into
masterfrom
ib/clangtidy-high-signal

Conversation

@ibell
Copy link
Copy Markdown
Contributor

@ibell ibell commented Apr 26, 2026

Summary

Tighten .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 (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.cpp

Before After
Warning count 5+ 1
Categories misc-include-cleaner, misc-use-internal-linkage, readability-isolate-declaration, readability-braces-around-statements, modernize-use-emplace modernize-use-emplace (auto-fixable)

src/Solvers.cpp

Before After
Warning count 15+ (cascading) 30
Dominant category misc-include-cleaner (Eigen::, std::, _HUGE, root_sum_square) cppcoreguidelines-init-variables (×27)
Other misc-const-correctness, readability-isolate-declaration performance-avoid-endl (×2), modernize-deprecated-headers (×1)

The 27× cppcoreguidelines-init-variables cluster 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 (catches if (n) for integer n; pointer conditions already allowed via existing CheckOption)
  • The project's 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-linkage
  • readability-* (except implicit-bool-conversion) — isolate-declaration, braces-around-statements, use-concise-preprocessor-directives, etc.
  • portability-*, boost-*, fuchsia-*, google-*, zircon-*, abseil-*, llvm*, altera* — irrelevant or noise

Preserved

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 CheckOptions for now-disabled checks: modernize-use-override.*, cppcoreguidelines-narrowing-conversions.*, misc-non-private-member-variables-in-classes.*.

Test plan

  • CI clang-tidy artifact for this PR contains far fewer entries than for prior PRs
  • Categories are limited to bugprone-, cppcoreguidelines-, modernize-, performance-, hicpp-* survivors
  • The 27 init-variables warnings on Solvers.cpp surface in the artifact (real signal we want)

Related

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant