skillfed

scan-build

Run the Clang static analyzer on projects with a compilation database.

scan-build v3.1.0 151.1K downloads/30d#10,943 on PyPI396
Permissive license MIT Active released

What it is and what it does

scan-build is a Python-based wrapper around the Clang static analyzer that automates analysis of C/C++ projects. It reads a compilation database (a JSON file describing how each source file should be compiled), runs the Clang analyzer against each entry, and produces reports of potential bugs in HTML or machine-readable plist format. The tool works with any build system that can generate a compilation database—CMake does this natively with a flag, and other build systems can use the Bear tool to capture compiler invocations.

The package requires clang to be installed separately and Python 3.10 or later. It has no Python dependencies, making installation straightforward. Unlike earlier versions, it no longer intercepts build commands; it purely analyzes existing compilation databases. This design simplifies the tool and shifts database generation to dedicated tools like Bear, which now support all major platforms including Windows.

Use it for:

  • Integrate static analysis into CI/CD pipelines with --status-bugs to fail builds when potential bugs are detected.
  • Analyze third-party or legacy C/C++ codebases without modifying their build configuration.
  • Generate HTML reports of code defects for code review and quality tracking across releases.
  • Exclude specific directories (e.g., vendor code) from analysis using --exclude flags.
  • Export machine-readable plist output for automated tooling and defect tracking systems.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Runs the Clang static analyzer on C/C++ projects using a compilation database and generates HTML or plist reports of potential bugs without modifying the build.

Yes. This is a mature, actively maintained tool (release 4 days old, 396 GitHub stars) with zero known vulnerabilities, no Python dependencies, and permissive MIT licensing. Install it if you need to run Clang static analysis on C/C++ projects with a compilation database. The only real prerequisite is having clang and a compilation database available—if your build system doesn't generate one natively, use Bear first.

Install

scan-build on PyPI

pip

pip install scan-build

uv

uv add scan-build

poetry

poetry add scan-build

Installing scan-build

Before you install

Low friction: pure Python wheel with no runtime dependencies. Actively maintained with a release 4 days old. Requires clang and a compilation database to function, but the tool itself installs cleanly.

License in practice

MIT license (permissive): you can use, modify, and distribute this package freely with minimal restrictions, making it safe for both open-source and commercial projects.

Quickstart

$ pip install scan-build
$ cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
$ clanganalyzer --cdb build/compile_commands.json --output report

Requires clang to be installed and a compilation database (compile_commands.json) for your project; Python 3.10 or later.

Verify before relying

  • Whether the tool's analysis accuracy and coverage match or exceed the original Perl scan-build implementation.
  • Performance characteristics when analyzing large codebases with many compilation database entries.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 4 days since the last release
Last repo commit
First released
Downloads 151,137/month — #10,943 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: scan_build-3.1.0-py3-none-any.whl

Keywords: Clang, scan-build, static analyzer

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: CProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: CompilersTopic :: Software Development :: Quality AssuranceTyping :: Typed

Tags

clang static analyzerc++ code analysiscompilation database analysisstatic code quality checkingclang bug detectionscan-build toolc code defect finder
static-analysisc-cppclang

More Quality Assurance packages