Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Codechecker | 1,771 | 1 | 2 days ago | 61 | March 05, 2021 | 313 | apache-2.0 | Python | ||
CodeChecker is an analyzer tooling, defect database and viewer extension for the Clang Static Analyzer and Clang Tidy | ||||||||||
Compiledb | 930 | 2 | 5 months ago | 9 | July 11, 2019 | 44 | gpl-3.0 | Python | ||
Tool for generating Clang's JSON Compilation Database files for make-based build systems. | ||||||||||
Hyrise | 635 | 19 hours ago | 78 | mit | C++ | |||||
Hyrise is a research in-memory database. | ||||||||||
Bazel Compilation Database | 377 | 4 months ago | 3 | apache-2.0 | Starlark | |||||
Tool to generate compile_commands.json from the Bazel build system | ||||||||||
Clreflect | 166 | 2 years ago | mit | C++ | ||||||
C++ Reflection using clang | ||||||||||
Compdb | 126 | 1 | 3 years ago | 5 | March 26, 2018 | 5 | mit | Python | ||
The compilation database Swiss army knife | ||||||||||
Ccrawl | 83 | 2 months ago | 8 | June 14, 2022 | gpl-3.0 | Python | ||||
clang-based search engine for C/C++ data structures, classes, prototypes & macros | ||||||||||
Vs Sourcetrail | 80 | 3 years ago | 11 | apache-2.0 | C# | |||||
Visual Studio Extension to communicate with Sourcetrail and generate a JSON Compilation Database from a Visual Studio Solution | ||||||||||
Modoocode | 33 | a year ago | 11 | apache-2.0 | C++ | |||||
Repo for the Modoocode. | ||||||||||
Clang Compilation Database Tool | 29 | 7 years ago | mit | Objective-C | ||||||
Tool that can be used to generate Clang Compilation DBs from Xcode. |
CodeChecker is a static analysis infrastructure built on the LLVM/Clang
Static Analyzer toolchain, replacing
scan-build
in a Linux or
macOS (OS X) development environment.
💡 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
(CodeChecker --help
):
CodeChecker subcommand |
Description |
---|---|
analyze |
Execute the supported code analyzers for the files recorded in a JSON Compilation Database. |
analyzer-version |
Print the version of CodeChecker analyzer package that is being used. |
analyzers |
List supported and available analyzers. |
check |
Perform analysis on a project and print results to standard output. |
checkers |
List the checkers available for code analysis. |
cmd |
View analysis results on a running server from the command line. |
fixit |
Apply automatic fixes based on the suggestions of the analyzers. |
log |
Run a build command, collect the executed compilation commands and store them in a JSON file. |
parse |
Print analysis summary and results in a human-readable format. |
server |
Start and manage the CodeChecker Web server. |
store |
Save analysis results to a database. |
version |
Print the version of CodeChecker package that is being used. |
web-version |
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
subcommand (CodeChecker cmd --help
):
CodeChecker cmd subcommand |
Description |
---|---|
runs |
List the available analysis runs. |
history |
Show run history of multiple runs. |
results |
List analysis result (finding) summary for a given run. |
diff |
Compare two analysis runs and show the difference. |
sum |
Show statistics of checkers. |
token |
Access subcommands related to configuring personal access tokens managed by a CodeChecker server. |
del |
Delete analysis runs. |
update |
Update an analysis run. |
suppress |
Manage and import suppressions of reports on a CodeChecker server. |
products |
Access subcommands related to configuring the products managed by a CodeChecker server. |
components |
Access subcommands related to configuring the source components managed by a CodeChecker server. |
login |
Authenticate into CodeChecker servers that require privileges. |
export |
Export comments and review statuses from CodeChecker. |
import |
Import comments and review statuses into CodeChecker. |
CodeChecker log
runs 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 analyze
uses the previously created JSON Compilation
Database to perform an analysis on the project, outputting analysis results in
a machine-readable (plist) format.CodeChecker parse
).CodeChecker store
).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:
Language | Analyzer |
---|---|
C/C++ | Clang Static Analyzer |
Clang Tidy | |
Clang Sanitizers | |
Cppcheck | |
Facebook Infer | |
Coccinelle | |
Smatch | |
Kernel-Doc | |
Sparse | |
cpplint | |
C# | Roslynator.DotNet.Cli |
Java | SpotBugs |
Facebook Infer | |
Python | Pylint |
Pyflakes | |
JavaScript | ESLint |
TypeScript | TSLint |
Go | Golint |
Markdown | Markdownlint |
Sphinx |
For details see supported code analyzers documentation and the Report Converter Tool.
Useful tools that can also be used outside CodeChecker.
pip
CodeChecker is available on the pypi and can be installed with the following command:
pip3 install codechecker
Note: this package can be installed on Linux
, OSX
and Windows
systems where pip3
command is available. On OSX
, intercept-build
must be
installed for logging (CodeChecker log
). On Windows
, logging is not
available.
snap
package managerCodeChecker is available on the Snap Store and can be installed with the following command:
sudo snap install codechecker --classic
Note: Unfortunately, the snap package supports only lower-case command names.
For this reason, you need to use codechecker
command instead of CodeChecker
everywhere. For a full list of available commands in the codechecker snap
package, run 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!
# In case of Cppcheck, the minimal supported version is 1.80.
sudo apt-get install clang clang-tidy cppcheck build-essential curl gcc-multilib \
git python3-dev python3-venv python3-setuptools
# 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_16.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.
# NOTE: if you want to develop CodeChecker, use the `venv_dev` target instead
# of `venv`.
make venv
source $PWD/venv/bin/activate
# [Optional] If you want to use external authentication methods (LDAP / PAM)
# follow the instructions in
# docs/web/authentication.md#external-authentication-methods
# 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 ..
Notes:
make package
will build ldlogger shared objects for
32bit
and 64bit
too. If you would like to build and package 64 bit only
shared objects and ldlogger binary you can set BUILD_LOGGER_64_BIT_ONLY
environment variable to YES
before the package build:
BUILD_LOGGER_64_BIT_ONLY=YES make package
.make package
will 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_DIST
environment variable to NO
before the package build:
BUILD_UI_DIST=NO make package
.make standalone_package
instead of make package
to avoid
having to manually activate the environment before running CodeChecker.If you have upgraded your system's Python to a newer version (e.g., from
2.7.6
to 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
checker_env
too:
cd ~/codechecker/venv
python3 -m venv .
For installation instructions for Mac OS X see Mac OS X Installation Guide documentation.
To run the CodeChecker server in Docker see the Docker documentation. You can find the CodeChecker web-server container at the Docker Hub.
You can install and use CodeChecker VSCode extension from the Visual Studio Marketplace or from Open VSX.
Main features:
For more information how to install and use this plugin see the repository of this extension.
CodeChecker can be executed via a reusable GitHub action for your project! You need only specify the build command, as if you would run the analysis locally.
For more information, check out the CodeChecker Static Analysis action on the GitHub Actions Marketplace.
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 check
command:
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 plist
XML format.
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
./reports_html/index.html
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 localhost:8001
.
The SQLite database containing the reports will be placed in your workspace
directory (~/.codechecker
by default), which can be provided via the -w
flag.
CodeChecker server
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.
CodeChecker has been ported completely to Python 3.
No Python 2 support is planned.
You will need at least Python version 3.8
.
Old virtual environments that were created with a Python 2 interpreter need to
be removed.
If you have upgraded your system's Python to a newer version (e.g., from
2.7
to 3.8
– this is the case when upgrading Ubuntu from 14.04 LTS
to 20.04 LTS), the installed environment will not work out-of-the-box. To fix
this issue, run the following command to upgrade your checker_env
too:
cd ~/codechecker/venv
python3 -m venv .
Clang 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.
Use Clang >= 3.8
or SVN trunk r251011
/ Git commit
efec163
— 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.