Skip to content

.clang-tidy not automatically find by clang-tidy 20.1.2 #136659

Closed
@kenchung285

Description

@kenchung285

I have a project that originally used clang-tidy 19.1.7, and we've recently upgraded to version 20.1.2. After upgrading, I've noticed a change in behavior regarding .clang-tidy file discovery.

In 19.1.7, clang-tidy was able to discover and apply our self-defined .clang-tidy files without explicitly passing the -config-file option. However, in 20.1.2, clang-tidy no longer discovers the .clang-tidy file at the project root unless we explicitly pass -config-file.

Worse, if we do pass the -config-file flag (pointing to the one in the project root), clang-tidy seems to ignore the .clang-tidy file under folder B, even when checking files located in that folder.

Here is the relevant directory structure:

project-root/
├── README.md
├── .clang-tidy           # Full rule config
├── folder A/
│   ├── some source files
│   └── ...
├── folder B/
│   └── .clang-tidy      # Contains "Checks: '-*'" to disable checks in this folder
└── folder C/
    ├── other source files
    └── ...

Expected behavior:

  • Without -config-file, clang-tidy should find and respect both the project-root .clang-tidy and the one under folder B.

Actual behavior:

  • Without -config-file, .clang-tidy is not found at all in 20.1.2.
  • With -config-file, .clang-tidy in folder B is ignored.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions