[all-commits] [llvm/llvm-project] 132f1d: [clang-tidy] Support specifying checks as a list i...

Carlos Galvez via All-commits all-commits at lists.llvm.org
Mon Apr 10 12:31:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 132f1d31fd66c30baf9773bf8f37b36a40fa7039
      https://github.com/llvm/llvm-project/commit/132f1d31fd66c30baf9773bf8f37b36a40fa7039
  Author: Carlos Galvez <carlosgalvezp at gmail.com>
  Date:   2023-04-10 (Mon, 10 Apr 2023)

  Changed paths:
    M clang-tools-extra/clang-tidy/ClangTidyOptions.cpp
    M clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/index.rst
    A clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-file/config-file-list-bracket
    A clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-file/config-file-list-dash
    M clang-tools-extra/test/clang-tidy/infrastructure/config-file.cpp

  Log Message:
  -----------
  [clang-tidy] Support specifying checks as a list in the config file

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




More information about the All-commits mailing list