I'm using clang-tidy
in a medium-size project with the following three folders:
srcA
srcB
external
I'm trying to exclude external
folder from the analysis, but with no luck.
The command I'm using is:
clang-tidy $SRC -p build/ --extra-arg=-ferror-limit=0'
with
SRC=srcA/file.cpp srcA/fileN.cpp srcB/file.cpp srcB/fileN.cpp ...
and a compilation database under build/
generated by cmake
.
Note that SRC doesn't contain any external
file, only from srcA
and srcB
(both .cpp and .hpp). Also, and obviusly, some files under srcA
and srcB
are using libraries under external
.
The 80% of the errors from clang-tidy
comes from external/
files, which I can't fix because there're third party libraries.
Below, the .clang-tidy
file I'm using:
Checks: '-*,readability-identifier-naming'
WarningsAsErrors: "*"
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.ClassMethodCase, value: camelBack }
- { key: readability-identifier-naming.VariableCase, value: camelBack }
- { key: readability-identifier-naming.PrivateMemberPrefix, value: m_ }
- { key: readability-identifier-naming.PrivateMemberCase, value: camelBack }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.MethodCase, value: camelBack }
- { key: readability-identifier-naming.ParameterCase, value: camelBack }
- { key: readability-identifier-naming.MemberCase, value: camelBack }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
- { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE }
- { key: readability-identifier-naming.ConstantCase, value: UPPER_CASE }
FormatStyle: 'file'
I know this question is already posted here, but I've tried the proposed solutions and none of them worked. For example, I've tried using HeaderFilterRegex
, matching only the desired files, and didn't work.
Am I missing something? Is this even possible to achieve (I've read in some page that this is a known bug from clang-tidy
)?
Checks: '-*'
) .clang-tidy in external directory (to take precedence over the root one)? – Wheatley