Reputation: 168
I am wondering what the best approach is to turn off some clang-tidy checks for either a given file or for a given function. For example, I want to turn on multi-thread warnings for the whole project, but I have a simple tool that uses the library that is single threaded.
Upvotes: 1
Views: 606
Reputation: 2663
Clang-tidy doesn't make this really easy.
You can use line-filter
option for this, without specifying the line ranges it can filter whole files. There is a catch however - this option filters files/line ranges IN so to exclude a file you have to specify everything else but that file (wildcards are supported but you'd have to name/suffix your files strategically).
To filter out functions you can either use //NOLINT
or //NOLINTNEXTLINE
or line-filter
again with specified line ranges. The first two are okay if you don't need them in too many places. line-filter
with specified line ranges is possible but clumsy to configure and easy to break when introducing code changes that add/remove lines.
Upvotes: 1