{"id":22334,"library":"scan-build","title":"scan-build","description":"A static code analyzer tool for Clang that uses compilation databases (compile_commands.json). Version 3.0.0 is the latest, requiring Python >=3.10 and dropping support for 3.6-3.9. The package is maintained with modern tooling (hatchling, ruff, pytest).","status":"active","version":"3.0.0","language":"python","source_language":"en","source_url":"https://github.com/rizsotto/scan-build","tags":["static analysis","clang","compilation database","code analyzer"],"install":[{"cmd":"pip install scan-build","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"Hyphen in package name becomes underscore in module name","wrong":"from scan-build import Analyze","symbol":"Analyze","correct":"from scan_build import Analyze"}],"quickstart":{"code":"from scan_build import Analyze\nfrom scan_build.report import Report\n\n# Analyze using compile_commands.json\nanalyzer = Analyze(compilation_database='compile_commands.json')\nreport = analyzer.run()\nprint(report.summary())","lang":"python","description":"Basic usage: specify a compilation database and run analysis."},"warnings":[{"fix":"Upgrade Python to 3.10 or later, and update scan-build to 3.0.0.","message":"Version 3.0.0 drops support for Python 3.6-3.9. Update to Python >=3.10.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Use the Python API from scan_build module instead of CLI.","message":"The old CLI entry point 'scan-build' (Perl-based) is not part of this Python package. Only the Python API is provided.","severity":"deprecated","affected_versions":">2.0.0"},{"fix":"Use 'from scan_build import ...'","message":"The module name is scan_build (underscore), not scan-build (hyphen). Importing with hyphen fails.","severity":"gotcha","affected_versions":"all"},{"fix":"Generate compile_commands.json using tools like bear or CMake with -DCMAKE_EXPORT_COMPILE_COMMANDS=ON.","message":"The package requires a compilation database (compile_commands.json). It does not work without one.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from scan_build import ...' (underscore).","cause":"Attempting to import using the hyphenated package name instead of the underscore module name.","error":"ModuleNotFoundError: No module named 'scan-build'"},{"fix":"Generate compile_commands.json (e.g., using CMake or bear) before running scan-build.","cause":"The compilation database file is missing or not generated.","error":"scan-build: error: compilation database not found at compile_commands.json"},{"fix":"Ensure scan-build >=3.0.0 is installed (pip install scan-build>=3.0.0) and import from scan_build module.","cause":"Incorrect import path or old version of scan-build that may not expose Analyze.","error":"ImportError: cannot import name 'Analyze' from 'scan_build' (unknown location)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}