codechecker

EricssonApache-2.0活跃维护

把 clang-tidy、Clang Static Analyzer 等静态和动态分析工具的结果统一收集进缺陷数据库,并提供网页界面浏览和跟踪代码缺陷。

CodeChecker is an analyzer tooling, defect database and viewer extension for static and dynamic analyzer tools.

v6.29.3发布于 2026-11-05 19:44 UTC2,632star503fork同步于 2026-11-10 05:42 UTC

怎么上手

从 README 代码块原样提取,可能是其中一种安装方式
pip3 install codechecker
curl -sL https://deb.nodesource.com/setup_24.x | sudo -E bash -
git clone https://github.com/Ericsson/CodeChecker.git --depth 1 ~/codechecker
硬件要求

README 没有说明硬件要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

这个项目的说明还在生成中,先参考下面「最近发版」和 README。

最近发版

5 个版本v6.29.3
  1. v6.29.3最新正式版2026-11-05 · 2026-11-05 19:44 UTC

    Security

    • Fix ZIP bomb vulnerability in massStoreRun The unzip() function in massStoreRun previously decompressed the entire uploaded ZIP into memory before writing it to disk, making it trivially exploitable by a malicious client sending a highly-compressed payload (ZIP bomb). The fix applies two independent limits using a 16 GiB cap:

      • During zlib decompression, decompressobj().decompress() is now called with max_length=16 GiB; a non-empty unconsumed_tail after decompression indicates the limit was exceeded and the request is rejected.
      • During ZIP extraction, file sizes are accumulated per-member before extraction; if the total exceeds 16 GiB the request is rejected before any data is written.
    • Prevent XSS script injection in static HTML output CodeChecker parse and CodeChecker cmd diff can generate static HTML pages displaying reports. Report messages containing </script> tags could previously be injected into the page's code, enabling XSS attacks. This is now properly escaped.

    • Invalidate session tokens at logout across all worker processes After a user logs out, session tokens are now invalidated at all worker processes. Session validity is checked in the central database on each API request, throttled by the refresh_time configuration parameter.

  2. v6.29.22026-11-05 · 2026-11-05 17:46 UTC
    查看更新说明

    Analyzer

    • Fix CTU parse-on-demand: normalize relative -include path to absolute (#5097) Fixes #5093 — relative -include paths in CTU parse-on-demand mode are now correctly normalized to absolute paths.

    • Disallow prefix matching for command line arguments (#5164) The --z3 flag was removed from CodeChecker analyze, but --z3-refutation remains valid. Because argparse allowed prefix matching, --z3 was silently falling back to --z3-refutation. Prefix matching is now disabled to prevent such ambiguities.

    Database / Backend

    • Pin SQLAlchemy to version 2.0 SQLAlchemy 2.1 defaults to psycopg3, which CodeChecker does not yet support. SQLAlchemy is now pinned to 2.0.x to maintain psycopg2 compatibility. PostgreSQL in CI is also pinned to version 18 for deterministic test results.

    • Fix declarative_base import for SQLAlchemy 2.0 compatibility run_db_model.py was importing declarative_base from the deprecated sqlalchemy.ext.declarative path. It now imports from sqlalchemy.orm, matching config_db_model.py and eliminating MovedIn20Warning on module load. Fixes #5116.

    • Disable PostgreSQL timeouts during schema migration and garbage collection Long-running queries during garbage collection and schema migration could be aborted by server-side statement_timeout or idle_in_transaction_session_timeout settings. These timeouts are now disabled for the duration of those operations.

    • Remove redundant code and set database connection timeout

      • Connection timeout limits are now specified in create_engine().
      • A redundant psql-based connectivity check in PostgreSQLServer.connect() was removed; the equivalent check already exists in check_schema().
      • Dead code cleaned up: unused check_env and interactive parameters removed throughout.
      • Exception logging improved — only the relevant exception and connection string are printed instead of full internal SQLAlchemy stack traces.
      • The Docker image no longer installs postgresql-client (it was only needed for the removed psql call).

    Web / Docker

    • Support TLS in the web container health check The Docker container health check now works correctly when TLS is enabled.

    GUI Improvements

    • Rework error display Errors are now displayed in a modern snackbar-style notification instead of the previous UI.

    • Make report step messages selectable (#5141)

      • A copy button has been added to report step messages for quick clipboard access.
      • Text selection is now enabled inside report step message boxes.
    • Fix git blame not showing on the first line The blame gutter used !line?.from to skip empty lines. Because the first line's offset is 0, !0 evaluated to true and its blame marker was dropped. The check is now line?.from == null, so offset 0 is treated as a valid line.

    • Fix reports file tree view filtering for relative paths Filtering in the reports view failed for paths stored as relative paths. Both the file path filter and the file tree view mode now handle relative paths correctly.

  3. v6.29.12026-09-17 · 2026-09-17 19:06 UTC
    查看更新说明
  4. v6.29.02026-09-08 · 2026-09-08 15:27 UTC
    查看更新说明

    Highlights :star2:

    :exclamation: Backward incompatible changes

    1. The gcc static analayzer checkers are renamed from gcc-<checker_name> to gcc-analyzer-<checker_name> e.g. gcc-out-of-bounds -> gcc-analyzer-out-of-bounds (https://github.com/Ericsson/codechecker/pull/5056)
    2. CodeChecker analyze --z3 flag has been removed as the Z3 constraint solver is unsupported by Clang Static Analyzer. Z3 for refutation still can be used. https://github.com/Ericsson/codechecker/pull/5055
    3. The deprecated CodeChecker analyze --tidy-config flag has been removed https://github.com/Ericsson/codechecker/pull/4972 CodeChecker analyze --analyzer-option clang-tidy:take-config-from-directory=true can be used instead.

    New File Tree view

    The new file tree view shows how the reports are distributed within files and directories. One can find the hot-spots, problematic files with the most reports. You can filter paths with wildcards, sort them by severity or review status, and pick paths with checkboxes. The tree opens up to the first folder that branches. The view mode and the set of open folders are saved in the URL, so a shared link shows the same view.

    Redesigned file tree view

    GCC compiler warnings as checkers

    Any -W GCC warning can now be turned on and reported like a normal checker, so compiler warnings show up next to the other analyzer results. (https://github.com/Ericsson/codechecker/pull/5056)

    OWASP Top 10 (2025), CWE Top 25 (2025) and CWE vulnerabilities guidelines

    New security guidelines were added, along with their rule and CWE mappings. They show up directly in the guideline statistics.

    OWASP Top 10 guideline statistics

    Richer SARIF output from parse

    CodeChecker parse now writes a more complete SARIF file. It includes suppression and review-status information and full rule details, and it lists all review statuses by default. The report-converter now also respects --trim-path-prefix when it exports SARIF.

    Analysis configuration stored with the run and shown in the GUI

    The skip file and other config files used for a run are now saved with the run and shown in the reworked analysis information dialog.

  5. v6.28.32026-08-25 · 2026-08-25 12:51 UTC
    查看更新说明

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    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.

    Web interface showing list of analysed projects and bugs

    Check out our DEMO showing some analysis results of open-source projects!

    Main features

    Command line C/C++ Analysis

    • Executes Clang-Tidy, Clang Static Analyzer with Cross-Translation Unit analysis, Statistical Analysis (when checkers are available), Cppcheck, GCC Static Analyzer and the Facebook Infer Analyzer.
    • Creates the JSON compilation database by wiretapping any build process (e.g., CodeChecker log -b "make").
    • Automatically analyzes GCC cross-compiled projects: detecting GCC or Clang compiler configuration and forming the corresponding clang analyzer invocations.
    • Incremental analysis: Only the changed files and its dependencies need to be reanalyzed.
    • False positive suppression with a possibility to add review comments.
    • Result visualization in command line or in static HTML.

    Web-based report storage

    • You can store & visualize thousands of analysis reports of many analyzers like Clang Static Analyzer (C/C++), Clang Tidy (C/C++), Facebook Infer (C/C++, Java), Clang Sanitizers (C/C++), Spotbugs (Java), Pylint (Python), Eslint (Javascript) ... For a complete list see Supported Analyzers
    • Web application for viewing discovered code defects with a streamlined, easy experience (with PostgreSQL, or SQLite backend).
    • Gerrit and GitLab integration Shows analysis results as GitLab or Gerrit reviews.
    • Filterable (defect checker name, severity, source paths, ...) and comparable (calculates difference between two analyses of the project, showing which bugs have been fixed and which are newly introduced) result viewing.
    • Diff mode: This shows the list of bugs that have been introduced since your last analyzer execution.
    • Results can be shared with fellow developers, the comments and review system helps communication of code defects.
    • Easily implementable Thrift-based server-client communication used for storing and querying of discovered defects.
    • Support for multiple bug visualization frontends, such as the web application, a command-line tool and an Eclipse plugin.

    Command line features

    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 subcommandDescription
    analyzeExecute the supported code analyzers for the files recorded in a JSON Compilation Database.
    analyzer-versionPrint the version of CodeChecker analyzer package that is being used.
    analyzersList supported and available analyzers.
    checkPerform analysis on a project and print results to standard output.
    checkersList the checkers available for code analysis.
    cmdView analysis results on a running server from the command line.
    fixitApply automatic fixes based on the suggestions of the analyzers.
    logRun a build command, collect the executed compilation commands and store them in a JSON file.
    parsePrint analysis summary and results in a human-readable format.
    serverStart and manage the CodeChecker Web server.
    storeSave analysis results to a database.
    versionPrint the version of CodeChecker package that is being used.
    web-versionPrint 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 subcommandDescription
    runsList the available analysis runs.
    historyShow run history of multiple runs.
    resultsList analysis result (finding) summary for a given run.
    diffCompare two analysis runs and show the difference.
    sumShow statistics of checkers.
    tokenAccess subcommands related to configuring personal access tokens managed by a CodeChecker server.
    delDelete analysis runs.
    updateUpdate an analysis run.
    suppressManage and import suppressions of reports on a CodeChecker server.
    productsAccess subcommands related to configuring the products managed by a CodeChecker server.
    componentsAccess subcommands related to configuring the source components managed by a CodeChecker server.
    loginAuthenticate into CodeChecker servers that require privileges.
    exportExport comments and review statuses from CodeChecker.
    importImport comments and review statuses into CodeChecker.

    Usage flow

    Usage diagram

    • Step 1: 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.
    • Step 2: 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.
    • Step 3: In this step, you can do multiple things:
      • Parse and pretty-print the summary and results from analysis result files (CodeChecker parse).
      • Store the results to a running CodeChecker server (CodeChecker store).
      • Compare two analysis results/runs to show the results that differ between the two (CodeChecker cmd diff).
      • etc.

    For more information how to use CodeChecker see our user guide.

    User documentation

    C/C++ Analysis

    Web based report management

    Storage of reports from analyzer tools

    CodeChecker can be used as a generic tool for visualizing analyzer results.

    The following tools are supported:

    LanguageAnalyzer
    C/C++Clang Static Analyzer
    Clang Tidy
    Clang Sanitizers
    Cppcheck
    Facebook Infer
    Coccinelle
    Smatch
    Kernel-Doc
    Sparse
    cpplint
    C#Roslynator.DotNet.Cli
    JavaSpotBugs
    Facebook Infer
    PythonPylint
    Pyflakes
    JavaScriptESLint
    TypeScriptTSLint
    GoGolint
    MarkdownMarkdownlint
    Sphinx

    For details see supported code analyzers documentation and the Report Converter Tool.

    Common Tools

    Useful tools that can also be used outside CodeChecker.

    Helper Scripts

    Install guide

    Install CodeChecker via 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.

    Installing CodeChecker via the snap package manager

    CodeChecker 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.

    Linux: Build from source

    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.
    #       In case of gcc, the minimal supported version is 13.0.0.
    #       Infer: https://fbinfer.com/docs/getting-started
    sudo apt-get install clang clang-tidy cppcheck g++ build-essential curl \
          gcc-multilib git python3-dev python3-venv python3-setuptools
    
    # In case of venv_dev target and Ubuntu 23 Linux, install an additional library:
    sudo apt-get install libpq-dev
    
    # 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_24.x | sudo -E bash -
    sudo apt-get install -y nodejs
    
    # Install docker.
    # https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
    
    # 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:

    • By default, 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.
    • By default, the 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.
    • Use make standalone_package instead of make package to avoid having to manually activate the environment before running CodeChecker.

    Minimum Recommended package versions

    Upgrading environment after system or Python upgrade

    If you have upgraded your system's Python to a newer version (e.g., from 3.8 to 3.11 – this is the case when upgrading Ubuntu from 20.04 LTS to 22.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 .
    

    Mac OS X

    For installation instructions for Mac OS X see Mac OS X Installation Guide documentation.

    Docker

    To run the CodeChecker server in Docker see the Docker documentation. You can find the CodeChecker web-server container at the Docker Hub.

    Visual Studio Code plugin

    You can install and use CodeChecker VSCode extension from the Visual Studio Marketplace or from Open VSX.

    Main features:

    • Run CodeChecker analysis from the editor and see the results automatically.
    • Re-analyze the current file when saved.
    • Commands and build tasks for running CodeChecker as part of a build system.
    • Browse through the found reports and show the reproduction steps directly in the code.
    • Navigate between the reproduction steps.

    VSCode plugin

    For more information how to install and use this plugin see the repository of this extension.

    GitHub Actions CI

    CodeChecker executed in GitHub Actions

    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.

    Analyze your first project

    Setting up the environment in your Terminal

    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
    

    Execute analysis

    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.

    Export the reports as static HTML files

    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

    Optionally store the results in Web server & view the results

    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.

    Developer documentations

    Conference papers, presentations