Is there a place that documents the .clang-tidy
config file? All I could find is this:
$ clang-tidy -dump-config
---
Checks: '-*,some-check'
WarningsAsErrors: ''
HeaderFilterRegex: ''
FormatStyle: none
User: user
CheckOptions:
- key: some-check.SomeOption
value: 'some value'
specifically I would like to know what the valid values for FormatStyle and CheckOptions are.
clang-tidy is a clang-based C++ “linter” tool. Its purpose is to provide an extensible framework for diagnosing and fixing typical programming errors, like style violations, interface misuse, or bugs that can be deduced via static analysis.
Clang-tidy is a standalone linter tool for checking C and C++ source code files. It provides an additional set of compiler warnings—called checks—that go above and beyond what is typically included in a C or C++ compiler.
Clang-Tidy is a Clang-based tool for static code analysis. CLion shows Clang-Tidy checks the same way as its own code inspections, with quick-fixes available via the -button or Alt+Enter : Gif.
How do I run clang-tidy in VS Code? To manually run clang-tidy, open the Command Palette (Ctrl + Shift + P) and type “Run Code Analysis.” You can run clang-tidy on the active file, on all open files, or on the entire workspace.
I think I got it or at least part of it:
From the command line run
$ clang-tidy-6.0 -checks=* --dump-config
to see all CheckOptions values
Checks: 'clang-diagnostic-*,clang-analyzer-*,*'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- key: bugprone-argument-comment.StrictMode
value: '0'
- key: bugprone-assert-side-effect.AssertMacros
value: assert`$ clang-tidy-6.0 -checks=* --dump-config
.
.
.
and as for the FormatStyle options these are the same values you could specify for -format-style
-format-style=<string> -
Style for formatting code around applied fixes:
- 'none' (default) turns off formatting
- 'file' (literally 'file', not a placeholder)
uses .clang-format file in the closest parent
directory
- '{ <json> }' specifies options inline, e.g.
-format-style='{BasedOnStyle: llvm, IndentWidth: 8}'
- 'llvm', 'google', 'webkit', 'mozilla'
See clang-format documentation for the up-to-date
information about formatting styles and options.
This option overrides the 'FormatStyle` option in
.clang-tidy file, if any.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With