【问题标题】:What values are allowed in the .clang-tidy config file?.clang-tidy 配置文件中允许哪些值?
【发布时间】:2019-04-01 06:15:18
【问题描述】:

是否有记录.clang-tidy 配置文件的地方?我能找到的只有这个:

$ clang-tidy -dump-config
---
Checks:          '-*,some-check'
WarningsAsErrors: ''
HeaderFilterRegex: ''
FormatStyle:     none
User:            user
CheckOptions:
  - key:             some-check.SomeOption
    value:           'some value'

具体来说,我想知道 FormatStyle 和 CheckOptions 的有效值是什么。

【问题讨论】:

    标签: clang lint clang-tidy


    【解决方案1】:

    我想我明白了,或者至少部分明白了:

    从命令行运行 $ clang-tidy-6.0 -checks=* --dump-config 查看所有 CheckOptions 值

    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
      .
      .
      .
    

    对于 FormatStyle 选项,这些值与您可以为 -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.
    

    【讨论】:

      猜你喜欢
      • 2020-12-30
      • 2021-06-02
      • 2018-12-21
      • 2018-03-10
      • 1970-01-01
      • 1970-01-01
      • 2020-11-27
      • 2016-05-17
      • 2021-03-27
      相关资源
      最近更新 更多