Skip to content

Static Analysis

This is work in progress, all information should be considered preliminary. For how to enable static analysis see CMake configuration.

Targets Available

After successfully configuring MpdRoot, depending on static analysis tools selected various targets become available. Don't run static analysis on whole project, even if such target is available. Also, static analysis tools are configured to only provide recommendations, no automatic fixes are enabled. It is responsibility of developer to read the recommendations and work accordingly. Static analysis is currently available only for libraries (MpdRoot+MpdPhysics). It is not available for Macros and test targets. To run static analysis tool, simply run make target where target is one of the following:

Target Description
sa_all Run all static analyses available. Don't use.
sa_cltd Run Clang Tidy for all libraries. Don't use.
sa_cpch Run Cppcheck for all libraries. Don't use.
sa_iwyu Run IWYU for all libraries. Don't use.
sa_cltd_libName Run Clang Tidy for library libName
sa_cpch_libName Run Cppcheck for library libName
sa_iwyu_libName Run IWYU for library libName

In the table libName is full library name (e.g., MpdCore, MpdTpc, MpdpPhysics).

Tools Available

Clang Tidy

Clang based c++ static analysis tool. Used for basic cpp static analysis. It not only checks camelBack and CamelCase for variable and function names respectively, but also gives many advices how to modernize the code itself. While information provided by Clang Tidy is only recommendation, our goal will be to fix as many recommendations as possible, potentialy changing warnings to errors in the future.

Cppcheck

Another cpp static analysis code.

Include-What-You-Use (IWYU)

Tool, that strives to fix includes in the way, that only realy used header files are included. It is configured in a way to recomend forward declarations if possible.


Last update: May 19, 2026