Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cpp-linter/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,17 @@ pub struct TidyOptions {
/// `'-*'`.
/// - It is also possible to rely solely on a .clang-tidy config file by
/// specifying this option as a blank string (`''`).
/// - The default does not add the Clang Static Analyzer checks
/// (`clang-analyzer-*`) because they can make clang-tidy many times slower.
/// clang-tidy 22 and newer also leave them out of their own defaults.
/// clang-tidy 21 and older still enable them unless `-clang-analyzer-*` is added.
/// Add `clang-analyzer-*` to this option or to a .clang-tidy file to enable them.
///
/// See also clang-tidy docs for more info.
#[cfg_attr(feature = "bin", arg(
short = 'c',
long,
default_value = "boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*",
default_value = "boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,cppcoreguidelines-*",
default_missing_value = "",
num_args = 0..=1,
help_heading = "Clang-tidy options",
Expand Down
13 changes: 13 additions & 0 deletions docs/docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[mod-sys]: cli.md#-mod-sys
[no-mod-sys]: cli.md#-no-mod-sys
[ignore]: cli.md#-i-ignore
[tidy-checks]: cli.md#-c-tidy-checks
[database]: cli.md#-p-database
[repo-root]: cli.md#-r-repo-root
[pr-review]: cli.md#-p-pr-review
Expand Down Expand Up @@ -77,6 +78,7 @@ The old names can still be given together, as in v1 (for example
|---|---|---|
| [`-l`, `--lines-changed-only`][lines-changed-only] | `false` | `true` |
| [`-i`, `--ignore`][ignore] | `.github` | `.github` and `target` |
| [`-c`, `--tidy-checks`][tidy-checks] | includes `clang-analyzer-*` | no `clang-analyzer-*` |

Because `--lines-changed-only` is `true` by default and implies
[`--files-changed-only`][files-changed-only], v2 analyzes only the added lines of changed files
Expand All @@ -87,6 +89,17 @@ including files under `target`, pass:
cpp-linter --lines-changed-only=false --files-changed-only=false --ignore=.github
```

The default [`--tidy-checks`][tidy-checks] no longer adds the Clang Static Analyzer checks
(`clang-analyzer-*`), because they can make clang-tidy many times slower. clang-tidy 22 and newer
also leave them out of their own defaults, so with those versions they only run if a `.clang-tidy`
file or `--tidy-checks` enables them. clang-tidy 21 and older still enable them by default; add
`-clang-analyzer-*` to `--tidy-checks` to turn them off there. To keep them with any version, add
them back:

```shell
cpp-linter --tidy-checks="boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*"
```

## Fixes are written to a patch

In v1, `--fix` applied clang-format fixes in place, editing the files in the working tree.
Expand Down
Loading