How to tell clang-tidy to ignore some headers?

139 Views Asked by At

I have some C++ header files in a project that trigger clang-tidy warnings. For various reasons I cannot edit those files (to fix the warnings or to //NOLINT them) at this time, but I would still like to suppress the warnings when compiling sources that include those files.

I tried to tell clang-tidy to treat the folder where those files are located as a system include folder, but for some reason it does not seem to prevent it from displaying the warnings:

$ clang-tidy --header-filter=".*" --extra-arg="-isystem /Users/me/work/server/framework/random" --extra-arg-before="--driver-mode=g++" rpp/finder.cpp

211720 warnings generated.
423440 warnings generated.
/Users/me/work/server/framework/random/scale.h:51:37: warning: forwarding reference parameter 'gen' is never forwarded inside the function body [cppcoreguidelines-missing-std-forward]
   51 | static Result downScale(Generator&& gen, Result range)
      |                                     ^
/Users/me/work/server/framework/random/shuffle.h:19:104: warning: forwarding reference parameter 'g' is never forwarded inside the function body [cppcoreguidelines-missing-std-forward]
   19 | void shuffle(RandomAccessIterator first, RandomAccessIterator sentinel, UniformRandomNumberGenerator&& g)
      |                                                                                                        ^
Suppressed 424918 warnings (423436 in non-user code, 1482 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

What am I missing?

Edit:

Clarification: I want clang-tidy to check all headers except for the ones located in that specific folder. Thus the -header-filter=.*

I also tried wrapping the includes in

// NOLINTBEGIN
#include "framework/random/scale.h"
#include "framework/random/shuffle.h"
// NOLINTEND

But that didn't suppress the warnings either.

0

There are 0 best solutions below