awslabs / palace

3D finite element solver for computational electromagnetics
https://awslabs.github.io/palace/dev
Apache License 2.0
249 stars 51 forks source link

Run `clang-tidy` in CI #37

Open nikosavola opened 1 year ago

nikosavola commented 1 year ago

clang-tidy could be run in CI in addition to clang-format for enforcung the style provided in .clang-tidy.

Roughly the following could work:

mkdir build && cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
run-clang-tid
sebastiangrimberg commented 1 year ago

Hi @nikosavola, yes this is indeed possible and made even easier so by just configuring using -DANALYZE_SOURCES_CLANG_TIDY=ON (or -DANALYZE_SOURCES_CPPCHECK=ON to do static analysis using cppcheck).

The reason why these are not enforced via the CI currently is that the .clang-tidy configuration is rather experimental. It is useful as a developer tool, but I am not yet certain that it is worth enforcing over the entire codebase. There was a relatively recent PR which may be of interest to you which looked at the changes required to satisfy the various clang-tidy noise, though it was closed since it was deemed this was not a very high priority item at the time. Hope this is helpful!

sebastiangrimberg commented 1 year ago

Hi @nikosavola, just following up here. Does my response seem reasonable? If you're interested in making a contribution to run clang-tidy checks in the CI that would be great and I would be happy to help in any discussions of source code changes or config file settings in order to get the current main to build cleanly. Otherwise, if we should keep it only as a development tool, I can close this issue.

nikosavola commented 1 year ago

Hi @nikosavola, just following up here. Does my response seem reasonable? If you're interested in making a contribution to run clang-tidy checks in the CI that would be great and I would be happy to help in any discussions of source code changes or config file settings in order to get the current main to build cleanly. Otherwise, if we should keep it only as a development tool, I can close this issue.

Hi, I think I can make a contribution at some point in the near future, so no need to close yet 😁