Skip to content

perf: leave clang-analyzer-* out of the default --tidy-checks - #561

Merged
2bndy5 merged 1 commit into
mainfrom
claude/project-thread-sgpviu
Nov 10, 2026
Merged

2bndy5 merged 1 commit into
mainfrom
claude/project-thread-sgpviu

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Part of #518 (item 1, which @2bndy5 agreed to in the issue). Items 2 and 3 (result cache, compile DB dedup) are not touched here.

What changes

  • The default --tidy-checks no longer contains clang-analyzer-*. Everything else in the default stays the same.
  • The --tidy-checks help (and so cli.md) says why and how to turn the analyzer back on.
  • The migration guide lists the changed default and gives the v1 value to restore it.

Effect per clang-tidy version

--tidy-checks is appended to clang-tidy's own Checks, so this PR only stops cpp-linter from adding the analyzer. It does not force it off:

  • clang-tidy 22 and newer: the analyzer is off unless a .clang-tidy file or --tidy-checks enables it. (LLVM 22 removed it from clang-tidy's defaults; our default was adding it back.)
  • clang-tidy 21 and older: no change, because clang-tidy's own default still has clang-analyzer-*. The docs say to add -clang-analyzer-* to turn it off there.

I did not put -clang-analyzer-* into the default, because it would also turn off the analyzer for users whose .clang-tidy enables it.

Tests

About the concern in #518 that tests might expect analyzer findings: the test assets (tests/demo, tests/reviews_test_assets) have a .clang-tidy that enables clang-analyzer-*, so their results do not change. No test asserts the default value.

  • cargo nextest run --package cpp-linter --package clang-tools-manager --features bin --lib --tests --profile all with CLANG_VERSION=18: 279 passed, 1 skipped.
  • Same with --profile ci and CLANG_VERSION=23: 44 passed.
  • cargo clippy --all-features --all-targets -- -D warnings, cargo fmt --check, and pre-commit (incl. cspell) on the changed files: clean.

Manual check

A file with a null dereference (clang-analyzer-core.NullDereference), no .clang-tidy, -l false -f false -s '', release builds of main and this branch:

clang-tidy main this PR
18 (system) analyzer finding reported analyzer finding reported (clang-tidy's own default)
22 (-V 22) analyzer finding reported not reported
23 (-V 23) analyzer finding reported not reported
  • This PR with -V 23 and clang-analyzer-* added back to --tidy-checks: reported again.
  • This PR with -V 23 and a .clang-tidy of Checks: 'clang-analyzer-core.*': reported.
  • This PR with -V 18 and -clang-analyzer-* added: not reported.
  • Other findings (readability, modernize, cppcoreguidelines) are identical in every case.
  • Time on a small STL-heavy file (<regex>, <map>, ...) with -V 23: about 5.4–6.0 s on main, 1.5–1.9 s with this PR.

Not in this PR

cpp-linter-action's tidy-checks default still contains clang-analyzer-*. #518 asks whether the action should follow; that is a separate change in the action repo.

Summary by CodeRabbit

  • Changes
    • The default --tidy-checks list no longer includes clang-analyzer-* checks. With clang-tidy 22 and newer, these checks are omitted by default; versions 21 and older may still enable them unless explicitly disabled.
  • Documentation
    • Updated the option reference and migration guide to describe the changed default and explain how to disable or re-enable these checks.

The Clang Static Analyzer checks can make clang-tidy many times slower
(see #518). clang-tidy 22 removed them from its own defaults, but our
default added them back. Users can still enable them in a .clang-tidy
file or with --tidy-checks.

Document the change in the CLI help and the migration guide, including
that clang-tidy 21 and older still enable them by default.

Part of #518
@shenxianpeng shenxianpeng self-assigned this Nov 9, 2026
@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The default --tidy-checks value no longer includes clang-analyzer-*. The migration guide describes this default, version-specific clang-tidy behavior, and how to enable or disable the checks.

Changes: Tidy Check Defaults

Layer / File(s) Summary
Update tidy-check default and migration guidance
cpp-linter/src/cli/mod.rs, docs/docs/migration.md
The CLI default excludes clang-analyzer-*. The migration guide documents the v2 default, explains the behavior in clang-tidy 21 and older versus version 22 and newer, and gives an example for enabling the checks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • Issue 518 proposes removing clang-analyzer-* from the default --tidy-checks; this change makes that default update and documents how to enable the checks again.
  • Issue 514 calls for a CLI v1-to-v2 migration guide; this change adds migration guidance for the --tidy-checks default.
Merge Risk: Minimal · up to 65f42

The default no longer explicitly enables analyzer checks; the documentation explains version-specific behavior. No merge-blocking risk is identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: removing clang-analyzer-* from the default --tidy-checks list.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b2a9a603-0da5-4420-8aac-8ae3f0b82204
Commits

Reviewing files that changed from the base of the PR and between ecb3fad and 65f42d2.

Files selected for processing: 2

  • cpp-linter/src/cli/mod.rs
  • docs/docs/migration.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.89%. Comparing base (ecb3fad) to head (65f42d2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #561   +/-   ##
=======================================
  Coverage   99.89%   99.89%           
=======================================
  Files          29       29           
  Lines        7671     7671           
=======================================
  Hits         7663     7663           
  Misses          8        8           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@2bndy5
2bndy5 merged commit d26b5fe into main Nov 10, 2026
80 of 81 checks passed
@2bndy5
2bndy5 deleted the claude/project-thread-sgpviu branch November 10, 2026 01:11
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.

2 participants