CodeChecker is ported to Python3!
No Python2 support is planned. The minimal required Python3 version is 3.6.
Old virtual environments needs to be removed!
💡 Check out our DEMO showing some analysis results of open-source projects!
CodeChecker log -b "make")
CodeChecker command has many subcommands which can be used for example to
log and analyze your projects, print the results or start a web server. For
full list see the following table or check the help message of this command
||Execute the supported code analyzers for the files recorded in a JSON Compilation Database.|
||Print the version of CodeChecker analyzer package that is being used.|
||List supported and available analyzers.|
||Perform analysis on a project and print results to standard output.|
||List the checkers available for code analysis.|
||View analysis results on a running server from the command line.|
||Apply automatic fixes based on the suggestions of the analyzers.|
||Run a build command, collect the executed compilation commands and store them in a JSON file.|
||Print analysis summary and results in a human-readable format.|
||Start and manage the CodeChecker Web server.|
||Save analysis results to a database.|
||Print the version of CodeChecker package that is being used.|
||Print the version of CodeChecker server package that is being used.|
CodeChecker cmd subcommand also has many other subcommands which can be used
to get data (products, runs, results, statistics) from a running CodeChecker
server. For full list see the following table or check the help message of this
CodeChecker cmd --help):
||List the available analysis runs.|
||Show run history of multiple runs.|
||List analysis result (finding) summary for a given run.|
||Compare two analysis runs and show the difference.|
||Show statistics of checkers.|
||Access subcommands related to configuring personal access tokens managed by a CodeChecker server.|
||Delete analysis runs.|
||Update an analysis run.|
||Manage and import suppressions of reports on a CodeChecker server.|
||Access subcommands related to configuring the products managed by a CodeChecker server.|
||Access subcommands related to configuring the source components managed by a CodeChecker server.|
||Authenticate into CodeChecker servers that require privileges.|
||Export comments and review statuses from CodeChecker.|
||Import comments and review statuses into CodeChecker.|
CodeChecker logruns the given build command and records the executed compilation steps. These steps are written to an output file (Compilation Database) in a JSON format.
CodeChecker analyzeuses the previously created JSON Compilation Database to perform an analysis on the project, outputting analysis results in a machine-readable (plist) format.
CodeChecker cmd diff).
For more information how to use CodeChecker see our user guide.
CodeChecker can be used as a generic tool for visualizing analyzer results.
The following tools are supported:
|C/C++||Clang Static Analyzer|
Useful tools that can also be used outside CodeChecker.
CodeChecker is available on the Snap Store and can be installed with the following command:
sudo snap install codechecker --classic
Note: unfortunately snap package supports only lower case command names.
For this reason you need to use
codechecker command instead of
everywhere. For full list of available commands in the codechecker snap package
snap info codechecker.
For a detailed dependency list, and for instructions on how to install newer Clang and Clang-Tidy versions, please see Requirements. The following commands are used to bootstrap CodeChecker on Ubuntu 20.04 LTS:
# Install mandatory dependencies for a development and analysis environment. # NOTE: clang or clang-tidy can be any sufficiently fresh version, and need not # come from package manager! sudo apt-get install clang clang-tidy build-essential curl gcc-multilib \ git python3-dev python3-venv # Install nodejs dependency for web. In case of Debian/Ubuntu you can use the # following commands. For more information see the official docs: # https://nodejs.org/en/download/package-manager/ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs # Check out CodeChecker source code. git clone https://github.com/Ericsson/CodeChecker.git --depth 1 ~/codechecker cd ~/codechecker # Create a Python virtualenv and set it as your environment. make venv source $PWD/venv/bin/activate # Build and install a CodeChecker package. make package # For ease of access, add the build directory to PATH. export PATH="$PWD/build/CodeChecker/bin:$PATH" cd ..
make packagewill build ldlogger shared objects for
64bittoo. If you would like to build and package
64 bit onlyshared objects and ldlogger binary you can set
BUILD_LOGGER_64_BIT_ONLYenvironment variable to
YESbefore the package build:
BUILD_LOGGER_64_BIT_ONLY=YES make package.
make packagewill build the UI code if it's not built yet or the UI code is changed. If you wouldn't like to build the UI code you can set the
BUILD_UI_DISTenvironment variable to
NObefore the package build:
BUILD_UI_DIST=NO make package.
If you have upgraded your system's Python to a newer version (e.g. from
2.7.12 – this is the case when upgrading Ubuntu from
14.04.2 LTS to 16.04.1 LTS), the installed environment will not work
out-of-the-box. To fix this issue, run the following command to upgrade your
cd ~/codechecker/venv python3 -m venv .
For installation instructions for Mac OS X see Mac OS X Installation Guide documentation.
These steps must always be taken in a new command prompt you wish to execute analysis in.
source ~/codechecker/venv/bin/activate # Path of CodeChecker package # NOTE: SKIP this line if you want to always specify CodeChecker's full path. export PATH=~/codechecker/build/CodeChecker/bin:$PATH # Path of the built LLVM/Clang # NOTE: SKIP this line if clang is available in your PATH as an installed Linux package. export PATH=~/<user path>/build/bin:$PATH
Analyze your project with the
CodeChecker check -b "cd ~/your-project && make clean && make" -o ./results
check will print an overview of the issues found in your project by the
analyzers. The reports will be stored in the
./results directory in
You can visualize the results as static HTML by executing
CodeChecker parse -e html ./results -o ./reports_html
An index page will be generated with a list of all repors in
If you have hundreds of results, you may want to store them on the web server with a database backend.
Start a CodeChecker web and storage server in another terminal or as a
background process. By default it will listen on
The SQLite database containing the reports will be placed in your workspace
~/.codechecker by default), which can be provided via the
Store your analysis reports onto the server to be able to use the Web Viewer.
CodeChecker store ./results -n my-project
Open the CodeChecker Web Viewer in your browser, and you should be greeted with a web application showing you the analysis results.
3.6 or earlier releases are NOT supported due to CodeChecker
relying on features not available in those releases.
If you have Clang
3.7 installed you might see the following warning message:
Hash value wasn't found in the plist file.
>= 3.8or trunk
r251011— otherwise CodeChecker generates a simple hash based on the filename and the line content. This method is applied for Clang-Tidy results too, because Clang-Tidy does not support bug identifier hash generation currently.