clang-tidy: Ignore specific folder from clang-tidy analysis

Viewed 2148

I have the following directory structure

├── .clang-format

├── .clang-tidy

├── external

├── scripts

└── source

For my clang tidy execution I want to only include headers from the source folder and exclude ones from external. The following setting does not work for either match HeaderFilterRegex: '^(source)+(?!.*external).*' The format of the regex is correct

In the .clang-tidy file If I only include HeaderFilterRegex: '^(?!.*external).*' it excludes the external folder but doesn't include the source header files

and similarly if I only include this check HeaderFilterRegex: '(src/)' it doesn't exclude the external files.

Update

Ok this seems like it is related to the fact clang uses Posix ERE regex flavor (thanks @pablo285) and this does not support negative lookahead. I would have thought this was a fairly standard requirement for using clang-tidy, excluding certain folders from the analysis.

0 Answers
Related