Skip to content

[clang-tidy] Silent warning instead of an error when readability-identifier-naming cannot parse a .clang-tidy file #158009

@carlosgalvezp

Description

@carlosgalvezp

Consider this example:

$ cat main.cpp
#include "foo.h"
$ cat include/foo.h
#define poorNamedMacro
$ cat include/.clang-tidy
InvalidOption
$ cat .clang-tidy 
CheckOptions: {
  readability-identifier.naming.MacroDefinitionCase: UPPER_CASE
}

Running clang-tidy:

$ clang-tidy -checks=-*,readability-identifier-naming main.cpp -header-filter=.*  -- -I include/
/tmp/include/.clang-tidy:1:1: error: not a mapping
InvalidOption
^~~~~~~~~~~~~
Error parsing /tmp/include/.clang-tidy: Invalid argument

$ echo $?
0

The .clang-tidy file in the include folder has invalid syntax. readability-identifier-naming picks up this file when processing a warning from a header next to it. However it does not make clang-tidy fail with an error upon parse failure, like clang-tidy would do with the "main" .clang-tidy file.

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