|
waLBerla 7.2
|
See also the Clang-Tidy Documentation.
This document briefly explains how to run a clang-tidy analysis and (auto-)fixing pass on the waLBerla code base.
cmake --preset clang-tidybuild/clang-tidypython utilities/clang-tidy/analyze.py -p utilities/clang-tidy/analyze.yml -c compile_commands.json -r ../..To run clang-tidy, CMake needs to be configured to emit a compile command data base which clang-tidy reads to figure out which files, with which compilation options, it should analyze. Also, the build system should be set up in Debug mode with additional debugging features enabled such that all debug code paths can be covered.
Here is a sample CMakeUserPresets.json with a configure preset called clang-tidy, which defines a build system that can be used for clang-tidy analysis:
The above configuration:
mesh_common and mesh modules, you can set WALBERLA_BUILD_WITH_OPENMESH to false.core and blockforest, you can set WALBERLA_BUILD_WITH_METIS and WALBERLA_BUILD_WITH_PARMETIS to false.This preset is contained in the CMakePresets.json file. To generate the build system defined by it, run cmake --preset clang-tidy.
We provide the analyze.py script in this directory to automate the clang-tidy analysis of the waLBerla code base. For an overview of its options, run python analyze.py --help.
To run the full analysis pass, with your shell located in the waLBerla project root directory, you can use the following command:
In there, the -p option specifies the parameter file, and the -c option says where to find the compile database. You can specify a custom parameter file to restrict the set of modules and apps to be analyzed.