
Specifying checks as a string is convenient for quickly using clang-tidy to run a handful of checks. However it is not suitable for projects that have a long list of enabled or disabled checks. It is specially troublesome in case one wants to interleave comments with the checks, to explain why they are enabled or disabled. Currently this can be achieved via multiline strings in YAML, but it's error-prone. For example, comments must end with a comma for clang-tidy to continue processing the list of globs; a missing comma will make clang-tidy silently ignore the rest of the list. Instead, enable passing a native YAML list to the "Checks" option in the config file. The implementation is done such that the old behavior is kept: a user can pass a string or a list. We can consider deprecating passing the checks as a string altogether in a future release, to simplify the internal logic of the YAML parser. Fixes https://github.com/llvm/llvm-project/issues/51428 Differential Revision: https://reviews.llvm.org/D147876
21 lines
1.2 KiB
C++
21 lines
1.2 KiB
C++
// RUN: clang-tidy -config-file=%S/Inputs/config-file/config-file -dump-config -- | FileCheck %s -check-prefix=CHECK-BASE
|
|
// CHECK-BASE: Checks: {{.*}}hicpp-uppercase-literal-suffix
|
|
// RUN: clang-tidy -config-file=%S/Inputs/config-file/config-file-spaces --list-checks -- | FileCheck %s -check-prefix=CHECK-SPACES
|
|
// CHECK-SPACES: Enabled checks:
|
|
// CHECK-SPACES-NEXT: hicpp-uppercase-literal-suffix
|
|
// CHECK-SPACES-NEXT: hicpp-use-auto
|
|
// CHECK-SPACES-NEXT: hicpp-use-emplace
|
|
// CHECK-SPACES-EMPTY:
|
|
// RUN: clang-tidy -config-file=%S/Inputs/config-file/config-file-list-dash --list-checks -- | FileCheck %s -check-prefix=CHECK-LIST-DASH
|
|
// CHECK-LIST-DASH: Enabled checks:
|
|
// CHECK-LIST-DASH-NEXT: hicpp-uppercase-literal-suffix
|
|
// CHECK-LIST-DASH-NEXT: hicpp-use-auto
|
|
// CHECK-LIST-DASH-NEXT: hicpp-use-emplace
|
|
// CHECK-LIST-DASH-EMPTY:
|
|
// RUN: clang-tidy -config-file=%S/Inputs/config-file/config-file-list-bracket --list-checks -- | FileCheck %s -check-prefix=CHECK-LIST-BRACKET
|
|
// CHECK-LIST-BRACKET: Enabled checks:
|
|
// CHECK-LIST-BRACKET-NEXT: hicpp-uppercase-literal-suffix
|
|
// CHECK-LIST-BRACKET-NEXT: hicpp-use-auto
|
|
// CHECK-LIST-BRACKET-NEXT: hicpp-use-emplace
|
|
// CHECK-LIST-BRACKET-EMPTY:
|