mctools / simplebuild

A very simple to use build system for projects with primarily C++/Python code, intended for usage by scientific developers without a strong SW-engineering background.
https://mctools.github.io/simplebuild/
Apache License 2.0
3 stars 1 forks source link

Use cppcheck or other static c++/c linters #62

Closed tkittel closed 6 months ago

tkittel commented 6 months ago

This is obviously useful, and now we are in conda envs, it might not be so difficult:

https://cppcheck.sourceforge.io/manual.pdf cppcheck myfile.c

There is a conda-forge package.

tkittel commented 6 months ago

Of course, we can also investigate other checkers, e.g. llvm based.

tkittel commented 6 months ago

CMake is able to export all the compiled commands in a json file:

https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html

And according to their manual cppcheck (and, I believe, also clang-tidy https://clang.llvm.org/docs/JSONCompilationDatabase.html) can use this as input. It might be worthwhile to simply optionally generate such .json files.

tkittel commented 6 months ago

We now have CI covering all of our simple-build-based open source repos with cppcheck.