Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude third_party from clang-tidy checks

I'm trying to run clang-tidy on a big project with a lot of files that include third party libraries:

#include "third_party/..."

And thus I receive a lot of errors corresponding to these third party libraries. Adding NOLINT to each include is not an option since the project is large (and it seems that it doesn't work).

I tried to use -header-filter, but I still receive errors from third party libraries.

clang-tidy -header-filter='-third_party' "${SOURCE_FILES[@]}"

Is it possible to exclude third_party/* from checks?

like image 595
Ivan Avatar asked Oct 16 '22 08:10

Ivan


1 Answers

You should flag these headers as system headers.

You can do this via

#pragma clang system_header

These headers will get ignored by clang-tidy and will produce no warnings.

like image 195
interlocutor Avatar answered Oct 18 '22 14:10

interlocutor