I have code like the following
int do_thing( int arg1, int arg2, int arg3 ) { // NOLINT : don't care that arg2 and arg3 aren't used
return arg1;
}
the NOLINT comment suppresses a clang-tidy warning normally. However, how can I 'reenable' clang-tidy for that line w/o changing my code?
AFAIK there is no easy way to do this the way you want. Whenever clang-tidy finds the NOLINT comment, it just skips that line, there is no command-line option to prevent this behavior.
Since NOLINT is placed in comments, you cannot use preprocessor as comments are stripped before macro expansion.
What you can do is find and replace // NOLINT
with some other (preferably unique) text like // DISABLE_NOLINT
, run your clang-tidy check and then replace it back.
If you REALLY don't want to touch that code you can build your own clang-tidy from source where you modify static bool LineIsMarkedWithNOLINT()
in ClangTidyDiagnosticConsumer.cpp to always return false. Or even make a new command-line option to switch the behavior if that is worth the effort for you.