SimEng
SimEng copied to clipboard
Use clang-tidy for static analysis
Would be great if we can setup clang-tidy to perform checks in the CI. Note that clang-tidy is directly supported in CMake, we can simply do:
set(CMAKE_CXX_CLANG_TIDY
clang-tidy;
-format-style='my-style;
...
)
The warning shows up in the build step:
[ 33%] Building CXX object CMakeFiles/test.dir/main.cpp.o
/home/tom/test/main.cpp:3:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace]
using namespace std;
If configured correctly, the output should be identical to CLion's diagnostics.
Once this is done we can open a PR to squash all warnings.
This would probably need to be behind a flag (e.g SIMENG_CLANG_TIDY) because not everyone has clang-tidy.