Skip to main content

static code analyzer tool for Clang with compilation database support.

Project description

https://img.shields.io/pypi/v/scan-build.svg https://img.shields.io/pypi/l/scan-build.svg https://img.shields.io/pypi/dm/scan-build.svg https://img.shields.io/pypi/pyversions/scan-build.svg https://badges.gitter.im/rizsotto/scan-build.svg

clanganalyzer

A package designed to run the clang static analyzer against projects with existing compilation databases. The clanganalyzer tool runs the clang static analyzer against a compilation database.

How to get

It’s available from the Python Package Index and can be installed using pip or uv:

$ pip install scan-build

Or using uv (recommended):

$ uv add scan-build

For development:

$ uv sync --all-extras

Portability

Should be working on UNIX operating systems.

  • It has been tested on FreeBSD, GNU/Linux, OS X and Windows.

Prerequisites

  1. clang compiler, to compile the sources and have the static analyzer.

  2. python interpreter (version 3.10 or later). Supported versions: 3.10, 3.11, 3.12, 3.13.

How to use

To run the Clang static analyzer against a project with an existing compilation database goes like this:

$ clanganalyzer

Use --help to know more about the command.

Prerequisites

The clanganalyzer tool requires:

  1. An existing compilation database (compile_commands.json) for your project

  2. The clang static analyzer to be available on your system

You can generate a compilation database using various tools like CMake (with -DCMAKE_EXPORT_COMPILE_COMMANDS=ON), Bear, or other build systems that support compilation database generation.

Known problems

The tool requires a valid compilation database to function. If your project doesn’t have one, you’ll need to generate it first using your build system or tools like Bear.

Development

To set up a development environment:

$ git clone https://github.com/rizsotto/scan-build.git
$ cd scan-build
$ uv sync --all-extras

To run tests:

$ uv run pytest tests/unit
$ uv run lit -v tests/functional

To run linting and type checking:

$ uv run ruff check .
$ uv run ruff format .
$ uv run ty clanganalyzer

Problem reports

If you find a bug in this documentation or elsewhere in the program or would like to propose an improvement, please use the project’s issue tracker. Please describe the bug and where you found it. If you have a suggestion how to fix it, include that as well. Patches are also welcome.

License

The project is licensed under University of Illinois/NCSA Open Source License. See LICENSE.TXT for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scan_build-3.0.0.tar.gz (43.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scan_build-3.0.0-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file scan_build-3.0.0.tar.gz.

File metadata

  • Download URL: scan_build-3.0.0.tar.gz
  • Upload date:
  • Size: 43.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scan_build-3.0.0.tar.gz
Algorithm Hash digest
SHA256 499d1a99051680b919495c632ca692c9d09793660ed20aaeafc69c1451179b2e
MD5 d1e602277505c5cc8b98e5036b3abbb6
BLAKE2b-256 b90c3c44347b6f23b2012e1e8f42aa4b49086d0f67d22ac445305de01116505d

See more details on using hashes here.

Provenance

The following attestation bundles were made for scan_build-3.0.0.tar.gz:

Publisher: python-publish.yml on rizsotto/scan-build

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scan_build-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: scan_build-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scan_build-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d16e89b37413223f53fea81fc4f008135c63f15e255af1fcf3f6bc8297ab054b
MD5 2956b2b2846ef4255aee1209365c05b2
BLAKE2b-256 c99d0684d682e2ad347e3e68a78b6526b1dbb8bd41d036d95337751cabfec354

See more details on using hashes here.

Provenance

The following attestation bundles were made for scan_build-3.0.0-py3-none-any.whl:

Publisher: python-publish.yml on rizsotto/scan-build

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page