Package: processcdb
processcdbSimple front-end tool that can run various static analysis tools by
reading the required information from compile_commands.json.Provides output formatting for integration to other tools, parallerization
when needed, ability to override/reconfigure compiler flags and such on per
"tool" plugin requirements.Current development is done mainly on Windows but should work on any platform
where you have python, working development environment for your own project
and analyzer. Currently supported ones:clang-tidycppchecklizardInstallationProject is available in pypi as source distribution:pip install processcdbSince processcdb will also install few dependencies, usingpipxfor installation
is adviced.Once package is installed. Generate a configuration file with:processcdb --dump-configThis will generate barebones configuration file to default location (can be overwritten later with
--config argument). Edit this file to point "binary" options for those analyzer to point to their executable.
On windows, do not omit file extension.UsageBasic help:processcdb --helpAfter a process of generating a compile_commands.json, you can run processcdb with selected tool like this:processcdb --tool clang-tidyThis will try to locate the json file from current working directory and runs the tool, in this case
clang-tidy, against all files that are compiled and not blacklisted in processcdb comfig file or in
tools own configuration file and generates the output to standard output. If you need to run the tool when you
don't have access to change the current working directory, you can pass--cdband absolute location:processcdb --tool clang-tidy --cdb D:\src\myproject\build\compile_commands.jsonOne can direct the tools output to a file with--outputargument. Worth noting that that certain tools
(-t) can provide further arguments for post processing or tool specific purposes:processcdb --tool clang-tidy --cdb ~/src/myproject/build/compile_commands.json --output scan.log --xmlIf processcdb is invoked without passing--configargument, a default configuration file is used. Location
depends on operating system. If you need to analyze multiple projects with different sort of settings or
you want to analyze with different versions of a particular scanner, use multiple configuration files.For example, if you have a codebase thst you wish to scan with clang 11.0.0 but your project is really compiled
with Microsoft's msvc and you have another project that does compile with clang: make separate config file for
msvc and clang and invoke processcdb:processcdb --tool clang-tidy --config location/to/config/msvc17_clang_interop.iniConfigurationIf processcdb is invoked without passing--configargument, a default configuration file is used. To generate
a config file, pass--dump-configto the processcdb. To save the default config file to a file. either
capture the standard output or provide--configparameter.Configuration fileEach tool has a separate section and each section can be configured either in the tool specific section or
in default. Minimal. single tool configuratio would look something like this:[clang-tidy]
binary=C:\llvm-11.0.0\bin\clang-tidy.exeHere we have section for clang-tidy tool, where we are setting a variablebinaryto a value ofc:\llvm-11.0.0\bin\clang-tidy.exe.Pythonconfigparsermodule is used for loading/parsing of the file.Following variables are shared between the tools:binary- absolute path to a scanner.file_blacklist- list of file specs that should be omitted from the scanarg_blacklist- list of command line arguments passed to compiler that should not be passed to a tool.arg_additions- a list of of key/value pairs. If key is found in json, a value is placed into tool's
arguments.jobs- default number processes processcdb or the tool can use to process. 0 for auto detect.default_includes- list of paths that should be automatically passed to the tool as include paths which
might not be be specified in the compile_commands.jsondefault_args- list of arguments that should be passed to the tool that are not provided by the
compile_commands.jsonincludes_as_system: list of file specs that that should converted from normal -I include to -isystem
include.Each config option that is a list and allows multiple values, use semicolon as item separator.witharg_blacklist, one can strip away unnecessary command line arguments andarg_additioncan be used to
inject new arguments. For example, if is compiling a project in msvc and exceptions are enabled, following
configuration would allow clang-tidy tool to still work correctly:[clang-tidy]
binary=C:\llvm-11.0.0\bin\clang-tidy.exe
arg_blacklist=EHsc
arg_additions=EHsc=-Xclang,-fcxx-exceptionsAs first, processcdb would notice that compile_commands.json might have/EHscargument, it would add 2 new arguments-Xclangand '-fcxx-exceptions' and then arg_blacklist would then remove the original/EHsccppcheck tool also has optionsupression_filewhich, if needed, should be absolute location of cppchecks own
suppression file.Creditsclang-tidy toool's ability to convert the logfile to xml for direct jenkins support is part ofCodeCheckerproject
and its licensed under Apache 2.0LinksHome:https://github.com/rasjani/processcdbIssues:https://github.com/rasjani/processcdb/issues