[PATCH] D147955: [clang-tidy] Extend CheckOptions to support grouping checks options

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 11:43:21 PDT 2023


njames93 created this revision.
njames93 added reviewers: carlosgalvezp, LegalizeAdulthood, aaron.ballman.
Herald added subscribers: arphaman, mgrang, xazax.hun.
Herald added a project: All.
njames93 requested review of this revision.
Herald added subscribers: cfe-commits, aheejin.
Herald added a project: clang-tools-extra.

Remove a lot of duplication in configuration files by supporting nested dictionaries in the `CheckOptions` entry

For Example to set `ParameterCase`, `VariableCase` and `MemberCase` in `readability-identifier-naming` this new syntax is supported

  CheckOptions:
    readability-identifier-naming:
      ParameterCase: CamelCase
      VariableCase: camelBack
      MemberCase: UPPER_CASE

This maintains backwards compatability with the old method of input:

  CheckOptions:
    readability-identifier-naming.ParameterCase: CamelCase

And:

  CheckOptions:
    - key: readability-identifier-naming.ParameterCase
      value: CamelCase

This new syntax is also able to be interleaved with the current dictionary type input.

  CheckOptions:
    readability-identifier-naming.ParameterCase: CamelCase
    readability-identifier-naming:
      VariableCase: camelBack
      MemberCase: UPPER_CASE

Typically the current dictionary syntax is meant for checks with only one configured option

The `-dump-config` option has been updated to use the grouped syntax for checks with more than one option(while also having a deterministic ordering)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147955

Files:
  clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  clang-tools-extra/test/clang-tidy/checkers/google/module.cpp
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-files/4/44/.clang-tidy
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-files/4/key-dict/.clang-tidy
  clang-tools-extra/test/clang-tidy/infrastructure/config-files.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147955.512206.patch
Type: text/x-patch
Size: 11061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230410/e92dfe4b/attachment-0001.bin>


More information about the cfe-commits mailing list