Skip to main content

Tool to create suppression files for Cppcheck from its results.

Project description

cppcheck-suppressor

A tool that creates suppression files from Cppcheck output. The created suppression file can be used as a baseline to run further Cppcheck analysis, highlighting any new errors in the analyzed code.

Setting a baseline helps to see new issues. However, all the errors reported by Cppcheck should be reviewed with care.

Installation

Install the latest cppcheck-suppressor python module with

pip install cppcheck-suppressor

Usage

To use the cppcheck-suppressor together with Cppcheck, first make a throughout analysis of your project with Cppcheck without any suppressions and save the results to a xml file:

cppcheck --xml src/ 2> cppcheck_errors.xml

This assumes your sources are in the src/ folder. Use the arguments for Cppcheck that you would use otherwise - just no --suppress or --suppress-xml arguments, and keep the --xml argument.

Then use the cppcheck-suppressor to create a baseline from the Cppcheck results:

python -m cppcheck_suppressor -f cppcheck_errors.xml -o baseline.xml

And finally use the baseline in the further Cppcheck analyses:

cppcheck --suppress-xml=baseline.xml src/

Now, Cppcheck reports only new issues from the project. The baseline should be updated - especially when any errors are solved from the project.

Building the project

Installing module for developing:

To install everything that is needed to work with the project, run

pip install .[dev]

After making code changes, run this again to apply changes.

Running unit tests

To run the unit tests, run

pytest .

In the root of the project.

Building the python module

To build a local version of the tool, run

python -m build

This will create the packages in dist/ folder. Remember to update the __version__ attribute in __init__.py file, when needed.

To install this version, use

pip install dist/cppcheck_suppressor-<...>.whl

Publishing your version

If you want, you can publish your version to your python repository with:

python -m twine upload --repository-url ... dist/*

You likely want to update the pyproject.toml file contents for this.

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

cppcheck_suppressor-0.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

cppcheck_suppressor-0.0.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file cppcheck_suppressor-0.0.1.tar.gz.

File metadata

  • Download URL: cppcheck_suppressor-0.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cppcheck_suppressor-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c163438290ddded80c40d636adc5fb8b1a47334e6e99a939fb4a37a81e26afea
MD5 a3401a2f838e206293b4b32e3737d3fb
BLAKE2b-256 bd293e9903642cd95f418eba612356ebbbe6d0ff8674e972ed71f219cb77c7b3

See more details on using hashes here.

File details

Details for the file cppcheck_suppressor-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cppcheck_suppressor-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62d423001282a7714c1f8aa713592f0ffe05241bcb77de7f2b56c8393b5ae399
MD5 25446770ca6adf835f6aab9a17d21afd
BLAKE2b-256 950d0e34ebbeff746f05749595fda088cd321b3564589621768c7e4a01be40f9

See more details on using hashes here.

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