Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What values are allowed in the .clang-tidy config file?

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.

like image 746
Ezra Avatar asked Oct 27 '18 21:10

Ezra


People also ask

What does clang-tidy do?

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.

What are clang-tidy warnings?

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.

What is clang-tidy checks Android studio?

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 you use clang-tidy in Vscode?

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.


1 Answers

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.
like image 141
Ezra Avatar answered Sep 20 '22 07:09

Ezra