analyze#
Configure (if needed) and run static analysis.
clibra analyze --preset analyze # all tools
clibra analyze clang-tidy --preset analyze # one tool
clibra analyze clang-tidy --fix --preset analyze # apply fixes
Requires LIBRA_ANALYSIS to be ON in the preset’s
CMake cache. Without a tool subcommand, runs the analyze umbrella
target. With a tool subcommand, runs only that tool’s target. If a target
is unavailable, clibra emits an error with the reason from the build
system rather than a generic failure.
The available tool subcommands are clang-tidy, clang-check,
cppcheck, clang-format, and cmake-format.
Applying fixes#
--fix runs the auto-fixing variant of a tool instead of the
report-only one. Only clang-tidy and clang-check support fixing;
combining --fix with cppcheck, clang-format, or
cmake-format is an error. With no tool subcommand, --fix runs the
fix umbrella target.
Other flags#
-j/--jobs sets the parallel job count (defaults to the logical CPU
count). -k/--keep-going continues past errors and is only valid with
the Ninja or Unix Makefiles generators.
CMake equivalent#
# All tools
cmake --build --preset <name> --target analyze
# Single tool (report)
cmake --build --preset <name> --target analyze-clang-tidy
cmake --build --preset <name> --target analyze-clang-check
cmake --build --preset <name> --target analyze-cppcheck
cmake --build --preset <name> --target analyze-clang-format
cmake --build --preset <name> --target analyze-cmake-format
# Fixes (clang-tidy / clang-check only; umbrella "fix" with no tool)
cmake --build --preset <name> --target fix-clang-tidy
cmake --build --preset <name> --target fix-clang-check
cmake --build --preset <name> --target fix
For tool-specific configuration (suppression files, extra args, etc.) see Static analysis.
Flag reference#
clibra analyze#
Configure (if needed) and run static analysis.
The resolved preset defaults to analyze if --preset is not given and no default is configured.
Requires LIBRA_ANALYSIS=ON in the preset’s CMake cache. Without a subcommand, runs the analyze umbrella target. With a subcommand, runs only the corresponding target (e.g. analyze-clang-tidy). Emits an error with the reason from the build system if the target is unavailable.
Usage: clibra analyze [OPTIONS] [COMMAND]
Subcommands:#
clibra analyze clang-tidy—clibra analyze clang-check—clibra analyze cppcheck—clibra analyze clang-format—clibra analyze cmake-format—
Options:#
-j,--jobs <JOBS>— Parallel job count. Defaults to the # of logical CPUsDefault value:
4--fix— Attempt to apply fixes using the {clang-tidy,clang-check} tools, if they are run. Ignored for other tools-k,--keep-going— Continue building after errors-D <VAR=VALUE>— Forward -DVAR=VALUE to the CMake configure step when active. Ignored (with a warning) if the build directory exists and neither –reconfigure nor –fresh is given-r,--reconfigure— Force the configure step even if the build directory exists-f,--fresh— Reconfigure with a –fresh cmake build directory
clibra analyze clang-tidy#
Usage: clibra analyze clang-tidy [OPTIONS]
Options:#
clibra analyze clang-check#
Usage: clibra analyze clang-check [OPTIONS]
Options:#
clibra analyze cppcheck#
Usage: clibra analyze cppcheck [OPTIONS]
Options:#
clibra analyze clang-format#
Usage: clibra analyze clang-format [OPTIONS]
Options:#
clibra analyze cmake-format#
Usage: clibra analyze cmake-format [OPTIONS]