cppcheck-codequality
About
I wanted reports from CppCheck to appear in GitLab Merge Requests as Code Quality reports, which is a JSON file defined by the Code Climate team/service.
That's all this does: convert CppCheck XML to Code Climate JSON.
Usage
It is primarily used as a console script. As such, ensure you have Python 3's "scripts" directory in your PATH variable.
For example, on Linux, that might be $HOME/.local/bin.
To test, try the --help or --version flags:
cppcheck-codequality --help
CppCheck already has a script to convert its XML report to HTML for easy human reading. See "Chapter 11 HTML Report" in the CppCheck Manual
This script follows that example and provides similar command-line options. A typical workflow might look like this:
# Generate CppCheck report as XML
cppcheck --xml --enable=warning,style,performance ./my_src_dir/ 2> cppcheck_out.xml
# Convert to a Code Climate JSON report
cppcheck-codequality --input-file cppcheck_out.xml --output-file cppcheck.json
If you wanted, you could invoke the script directly as a module, like this:
# Run as a module instead (note the underscore in the module name here)
python -m cppcheck_codequality --input-file=cppcheck_out.xml --output-file=cppcheck.json
Now, in your GitLab CI script, upload this file as a Code Quality report.
my-code-quality:
script:
- [...]
artifacts:
reports:
codequality: cppcheck.json
Contributing
- Format with black
- Check with pylint
- Run tests
- Signoff commits (
git commit -s) to indicate you agree to Developer Certificate of Origin (DCO) Version 1.1 https://developercertificate.org/ - Create a GitLab merge request and I'll take a look!
Details
Setup development environment.
sudo apt install pipx
pipx install poetry
poetry install
source ./venv/bin/activate
Format
black ./
Use Tox to run tests in all python environments available on your system.
poetry run tox -e clean
poetry run tox
Credits & Trademarks
CppCheck is an open-source project with a GPL v3.0 license.
"Code Climate" may be a registered trademark of Code Climate, Inc. which provides super-cool free and paid services to the developer community.
"GitLab" is a trademark of GitLab B.V.
All other trademarks belong to their respective owners.
Metadata
Release files for cppcheck-codequality 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cppcheck_codequality-1.6.0.tar.gz | 10.2 kB | Without provenance | Details for cppcheck_codequality-1.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cppcheck_codequality-1.6.0-py3-none-any.whl | Python 3 | none | any | Details for cppcheck_codequality-1.6.0-py3-none-any.whl |
Total release size: 24.6 kB
Release files / cppcheck_codequality-1.6.0.tar.gz
| Download URL | cppcheck_codequality-1.6.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88ecf0f77484b7cfced3a54d2b1a07c00e8f45bce37826c4ab8b52ae3ef71a26
|
|
BLAKE2b-256 checksum How to use checksums |
8e967bfb4533b7e319370059bb0026d2319da180a3b6ed324142233d9e67e8cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.7.17 Linux/5.15.154+
|
Release files / cppcheck_codequality-1.6.0-py3-none-any.whl
| Download URL | cppcheck_codequality-1.6.0-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
035feee470bf707b079a65677bf7e2aa77fc6e9d7ede687b8193481f4ba124bc
|
|
BLAKE2b-256 checksum How to use checksums |
fef75ae4ad53ad1d2a7ce4e4ac77ffad1b16e594277eec64905e4a2bb0b21590
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.7.17 Linux/5.15.154+
|
Security for cppcheck-codequality 1.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.