Skip to content

Add the possibility to use clang-tidy with CbmRoot

Florian Uhlig requested to merge f.uhlig/cbmroot:add_clang_tidy_script into master

Refs #2967

Create the compile command database for clang-tidy

Add the sytem compiler include paths needed for our static standalone
clang-tidy binary to the list of include paths.
The paths are only added to the compilation units in the generated file
compile_commands.json which is used as input for clang-tidy. Without the
paths clang-tidy can't find the standard C and C++ header files.

The geometries, parameters and input data are not needed when running
clang-tidy, so don't waste time downloading them.
The still downloaded projects include header files which are used by CbmRoot
classes. If these header files are not found by clang-tidy the check of some
compilation units fail.

Use VC in scalar mode, otherwise system and hardware related header files are
needed which couldn't be found.
Fix an issue with an missing header file in KFParticle when using the scalar
VC version.

Add clang-tidy configuration

The format works for clang-tidy version 11 and 16.
Use clang-format automatically after running clang-tidy to also format the
changed file.
Add modernize-deprecated-headers check which warns about old C header files.

Add script to run clang-tidy on a source directory

The script allows to run clang-tidy on the complete project by passing the path
to the CbmRoot source directory or only a subdirectory by passing the path to
the subdirectory.
Some of the compilation units should not be tested by clang-tidy.
Exclude checking the dictionaries G__*.cxx since they generated by root-cling.
Exclude all targets from the external directory. This isn't our code and must
not be checked by us.
Edited by Florian Uhlig

Merge request reports