Let's talk about this simple example:
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "started " << argv[0] << " with " << argc << " params." << std::endl;
return 0;
}
We have a minimal .clang-tidy
file which looks like this:
Checks:
'-*,
cppcoreguidelines-*,
-cppcoreguidelines-pro-bounds-pointer-arithmetic'
WarningsAsErrors:
'*'
Even though I get the following warning:
src/main.cpp:5:30: error: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic,-warnings-as-errors]
std::cout << "started " << argv[0] << " with " << argc << " params." << std::endl;
^
I don't want to mess around with NOLINT
in my code and I don't want to add some additional flags to the CMakeLists.txt
file just because of clang-tidy
.
Is there a clean way, to mask some single checks in the .clang-tidy
file?
I'm using gcc/g++ and clang-tidy in version 6.0.0 on Linux. I'm aware of How to disable a clang-tidy check? - but it doesn't answer my question and the duplicate link is simply wrong.