aspect icon indicating copy to clipboard operation
aspect copied to clipboard

Add clang-tidy option to CMakeLists.txt.

Open MFraters opened this issue 3 years ago • 6 comments

This pull request would add an option to cmake to check the code with clang tidy, and even has the option to automatically fix a lot of the issues it finds which you can turn on and of with this script. Both options are off by default. I don't know if that is something we would want in ASPECT, but I found it to be useful for the world builder I would like to at least offer it for consideration.

If we decide we would want something like this in aspect, we can take a look at the precise flags which would be relevant for aspect. These are just the flags I use for the world builder, but I don't think they would all fully fit with the desired style of aspect.

MFraters avatar Jul 08 '21 06:07 MFraters

We already have .clang-tidy files in the repo that specify the check. We also have aspect/contrib/utilities/run_clang_tidy.sh. What advantage does your approach have?

tjhei avatar Jul 08 '21 13:07 tjhei

Is our code base even clean with regard to these flags at the moment? If not, maybe we can start by creating patches to this end.

Other than that, we could also make that a CI step rather than hooking it into the cmake configuration?

bangerth avatar Jul 08 '21 16:07 bangerth

There is still #3898, Timo do you plan to revive that at some point? I can certainly integrate clang/clang-tidy into the new tester in #4103. I am also voting for a CI step instead of (or in addition to) the cmake option.

gassmoeller avatar Jul 08 '21 16:07 gassmoeller

Ah, sorry. I totally forgot, and did not check, that there was already a clang tidy. Sorry about that. Integrating it into the ci would be nice.

The advantage of the cmake option is that you can set it to fix some stuff automatically (I didn't see that option in the script), and you can set it to automacally check every time you compile. The advantage of he script is that it is run outside the compilation step. I don't have preference for the way it is done, and I am happy to close this if we decide to go for the script option.

MFraters avatar Jul 08 '21 19:07 MFraters

you can set it to fix some stuff automatically

I should add that to the script. I used to just change that locally...

Timo do you plan to revive that at some point?

I can revive it, but we can talk about what the better option is...

tjhei avatar Jul 09 '21 01:07 tjhei

Anyone want to revive this?

bangerth avatar May 23 '22 02:05 bangerth