scan-build


Namescan-build JSON
Version 2.0.20 PyPI version JSON
download
home_pagehttps://github.com/rizsotto/scan-build
Summarystatic code analyzer wrapper for Clang.
upload_time2021-05-17 11:53:01
maintainer
docs_urlNone
authorLászló Nagy
requires_python>=3.6
licenseLICENSE.txt
keywords clang scan-build static analyzer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            .. image:: https://img.shields.io/pypi/v/scan-build.svg
       :target: https://pypi.python.org/pypi/scan-build

.. image:: https://img.shields.io/pypi/l/scan-build.svg
       :target: https://pypi.python.org/pypi/scan-build

.. image:: https://img.shields.io/pypi/dm/scan-build.svg
       :target: https://pypi.python.org/pypi/scan-build

.. image:: https://img.shields.io/pypi/pyversions/scan-build.svg
       :target: https://pypi.python.org/pypi/scan-build

.. image:: https://badges.gitter.im/rizsotto/scan-build.svg
        :target: https://gitter.im/rizsotto/scan-build?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge


scan-build
==========

A package designed to wrap a build so that all calls to gcc/clang are
intercepted and logged into a `compilation database`_ and/or piped to
the clang static analyzer. Includes intercept-build tool, which logs
the build, as well as scan-build tool, which logs the build and runs
the clang static analyzer on it.


How to get
----------

It's available from `the Python Package Index`_ ::

    $ pip install scan-build


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.6, 3.7, 3.8, 3.9).


How to use
----------

To run the Clang static analyzer against a project goes like this::

    $ scan-build <your build command>

To generate a compilation database file goes like this::

    $ intercept-build <your build command>

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

    $ analyze-build

Use ``--help`` to know more about the commands.


Limitations
-----------

Generally speaking, the ``intercept-build`` and ``analyze-build`` tools
together does the same job as ``scan-build`` does. So, you can expect the
same output from this line as simple ``scan-build`` would do::

    $ intercept-build <your build command> && analyze-build

The major difference is how and when the analyzer is run. The ``scan-build``
tool has three distinct model to run the analyzer:

1.  Use compiler wrappers to make actions.
    The compiler wrappers does run the real compiler and the analyzer.
    This is the default behaviour, can be enforced with ``--override-compiler``
    flag.

2.  Use special library to intercept compiler calls during the build process.
    The analyzer run against each modules after the build finished.
    Use ``--intercept-first`` flag to get this model.

3.  Use compiler wrappers to intercept compiler calls during the build process.
    The analyzer run against each modules after the build finished.
    Use ``--intercept-first`` and ``--override-compiler`` flags together to get
    this model.

The 1. and 3. are using compiler wrappers, which works only if the build
process respects the ``CC`` and ``CXX`` environment variables. (Some build
process can override these variable as command line parameter only. This case
you need to pass the compiler wrappers manually. eg.: ``intercept-build
--override-compiler make CC=intercept-cc CXX=intercept-c++ all`` where the
original build command would have been ``make all`` only.)

The 1. runs the analyzer right after the real compilation. So, if the build
process removes removes intermediate modules (generated sources) the analyzer
output still kept.

The 2. and 3. generate the compilation database first, and filters out those
modules which are not exists. So, it's suitable for incremental analysis during
the development.

The 2. mode is available only on FreeBSD, Linux and OSX. Where library preload
is available from the dynamic loader. Security extension/modes on different
operating systems might disable library preload. This case the build behaves
normally, but the result compilation database will be empty. (Notable examples
for enabled security modes are: SIP on OS X Captain and SELinux on Fedora,
RHEL and CentOS.) The program checks the security modes for SIP, and falls
back to 3. mode.

``intercept-build`` command uses only the 2. and 3. mode to generate the
compilation database. ``analyze-build`` does only run the analyzer against the
captured compiler calls.


Known problems
--------------

Because it uses ``LD_PRELOAD`` or ``DYLD_INSERT_LIBRARIES`` environment variables,
it does not append to it, but overrides it. So builds which are using these
variables might not work. (I don't know any build tool which does that, but
please let me know if you do.)


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


.. _compilation database: http://clang.llvm.org/docs/JSONCompilationDatabase.html
.. _the Python Package Index: https://pypi.python.org/pypi/scan-build
.. _issue tracker: https://github.com/rizsotto/scan-build/issues



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rizsotto/scan-build",
    "name": "scan-build",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "Clang,scan-build,static analyzer",
    "author": "L\u00e1szl\u00f3 Nagy",
    "author_email": "rizsotto@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f9/66/6a89d51839650913699e5d3dc89ac724db57848ad93723be1c203ab47d05/scan-build-2.0.20.tar.gz",
    "platform": "",
    "description": ".. image:: https://img.shields.io/pypi/v/scan-build.svg\n       :target: https://pypi.python.org/pypi/scan-build\n\n.. image:: https://img.shields.io/pypi/l/scan-build.svg\n       :target: https://pypi.python.org/pypi/scan-build\n\n.. image:: https://img.shields.io/pypi/dm/scan-build.svg\n       :target: https://pypi.python.org/pypi/scan-build\n\n.. image:: https://img.shields.io/pypi/pyversions/scan-build.svg\n       :target: https://pypi.python.org/pypi/scan-build\n\n.. image:: https://badges.gitter.im/rizsotto/scan-build.svg\n        :target: https://gitter.im/rizsotto/scan-build?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n\n\nscan-build\n==========\n\nA package designed to wrap a build so that all calls to gcc/clang are\nintercepted and logged into a `compilation database`_ and/or piped to\nthe clang static analyzer. Includes intercept-build tool, which logs\nthe build, as well as scan-build tool, which logs the build and runs\nthe clang static analyzer on it.\n\n\nHow to get\n----------\n\nIt's available from `the Python Package Index`_ ::\n\n    $ pip install scan-build\n\n\nPortability\n-----------\n\nShould be working on UNIX operating systems.\n\n- It has been tested on FreeBSD, GNU/Linux, OS X and Windows.\n\n\nPrerequisites\n-------------\n\n1. **clang compiler**, to compile the sources and have the static analyzer.\n2. **python** interpreter (version 3.6, 3.7, 3.8, 3.9).\n\n\nHow to use\n----------\n\nTo run the Clang static analyzer against a project goes like this::\n\n    $ scan-build <your build command>\n\nTo generate a compilation database file goes like this::\n\n    $ intercept-build <your build command>\n\nTo run the Clang static analyzer against a project with compilation database\ngoes like this::\n\n    $ analyze-build\n\nUse ``--help`` to know more about the commands.\n\n\nLimitations\n-----------\n\nGenerally speaking, the ``intercept-build`` and ``analyze-build`` tools\ntogether does the same job as ``scan-build`` does. So, you can expect the\nsame output from this line as simple ``scan-build`` would do::\n\n    $ intercept-build <your build command> && analyze-build\n\nThe major difference is how and when the analyzer is run. The ``scan-build``\ntool has three distinct model to run the analyzer:\n\n1.  Use compiler wrappers to make actions.\n    The compiler wrappers does run the real compiler and the analyzer.\n    This is the default behaviour, can be enforced with ``--override-compiler``\n    flag.\n\n2.  Use special library to intercept compiler calls during the build process.\n    The analyzer run against each modules after the build finished.\n    Use ``--intercept-first`` flag to get this model.\n\n3.  Use compiler wrappers to intercept compiler calls during the build process.\n    The analyzer run against each modules after the build finished.\n    Use ``--intercept-first`` and ``--override-compiler`` flags together to get\n    this model.\n\nThe 1. and 3. are using compiler wrappers, which works only if the build\nprocess respects the ``CC`` and ``CXX`` environment variables. (Some build\nprocess can override these variable as command line parameter only. This case\nyou need to pass the compiler wrappers manually. eg.: ``intercept-build\n--override-compiler make CC=intercept-cc CXX=intercept-c++ all`` where the\noriginal build command would have been ``make all`` only.)\n\nThe 1. runs the analyzer right after the real compilation. So, if the build\nprocess removes removes intermediate modules (generated sources) the analyzer\noutput still kept.\n\nThe 2. and 3. generate the compilation database first, and filters out those\nmodules which are not exists. So, it's suitable for incremental analysis during\nthe development.\n\nThe 2. mode is available only on FreeBSD, Linux and OSX. Where library preload\nis available from the dynamic loader. Security extension/modes on different\noperating systems might disable library preload. This case the build behaves\nnormally, but the result compilation database will be empty. (Notable examples\nfor enabled security modes are: SIP on OS X Captain and SELinux on Fedora,\nRHEL and CentOS.) The program checks the security modes for SIP, and falls\nback to 3. mode.\n\n``intercept-build`` command uses only the 2. and 3. mode to generate the\ncompilation database. ``analyze-build`` does only run the analyzer against the\ncaptured compiler calls.\n\n\nKnown problems\n--------------\n\nBecause it uses ``LD_PRELOAD`` or ``DYLD_INSERT_LIBRARIES`` environment variables,\nit does not append to it, but overrides it. So builds which are using these\nvariables might not work. (I don't know any build tool which does that, but\nplease let me know if you do.)\n\n\nProblem reports\n---------------\n\nIf you find a bug in this documentation or elsewhere in the program or would\nlike to propose an improvement, please use the project's `issue tracker`_.\nPlease describing the bug and where you found it. If you have a suggestion\nhow to fix it, include that as well. Patches are also welcome.\n\n\nLicense\n-------\n\nThe project is licensed under University of Illinois/NCSA Open Source License.\nSee LICENSE.TXT for details.\n\n\n.. _compilation database: http://clang.llvm.org/docs/JSONCompilationDatabase.html\n.. _the Python Package Index: https://pypi.python.org/pypi/scan-build\n.. _issue tracker: https://github.com/rizsotto/scan-build/issues\n\n\n",
    "bugtrack_url": null,
    "license": "LICENSE.txt",
    "summary": "static code analyzer wrapper for Clang.",
    "version": "2.0.20",
    "project_urls": {
        "Homepage": "https://github.com/rizsotto/scan-build"
    },
    "split_keywords": [
        "clang",
        "scan-build",
        "static analyzer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f3026ceed307db681195ed16c0b854f07c052f2ae4bd2e04d361357df0f0208",
                "md5": "8d62622df94a16783a5b0d17c5c7d3b3",
                "sha256": "f61cd6e05269819c8c5fb6d61eabb5cbc3c271ca99b89c096e45f82c454f63ef"
            },
            "downloads": -1,
            "filename": "scan_build-2.0.20-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8d62622df94a16783a5b0d17c5c7d3b3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 49376,
            "upload_time": "2021-05-17T11:52:59",
            "upload_time_iso_8601": "2021-05-17T11:52:59.916700Z",
            "url": "https://files.pythonhosted.org/packages/3f/30/26ceed307db681195ed16c0b854f07c052f2ae4bd2e04d361357df0f0208/scan_build-2.0.20-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f9666a89d51839650913699e5d3dc89ac724db57848ad93723be1c203ab47d05",
                "md5": "bc71d350745804e173fad55ff6694ce9",
                "sha256": "f1f9f1dc3daf906ef106077dbac4d872f5740843173dc74070ef3b39da3d0f07"
            },
            "downloads": -1,
            "filename": "scan-build-2.0.20.tar.gz",
            "has_sig": false,
            "md5_digest": "bc71d350745804e173fad55ff6694ce9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 46386,
            "upload_time": "2021-05-17T11:53:01",
            "upload_time_iso_8601": "2021-05-17T11:53:01.910791Z",
            "url": "https://files.pythonhosted.org/packages/f9/66/6a89d51839650913699e5d3dc89ac724db57848ad93723be1c203ab47d05/scan-build-2.0.20.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-05-17 11:53:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rizsotto",
    "github_project": "scan-build",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "scan-build"
}
        
Elapsed time: 0.08243s