Skip to main content

Prevent code coverage regressions

Project description

ccguard

you can only improve! :-)

ccguard compares the current code coverage to past code coverage. ccguard fails unless your new code coverage is equal or better than your past code coverage!

alt text alt text alt text

requires

  • python
  • git

welcome beta testers: setup

# prepare the package and install it
./distrib.sh

Should work on both python2 and python3. But python2 is not anymore supported.

contribute

./bootstrap.sh

please execute flake8, black, pytest and ccguard against all of your changes. (a pre-commit hook will ensure that everythng is fine before letting you commit)

./pre-commit

execute this tool

cd your-favorite-source-folder
# execute unit tests, collecting code coverage here
ccguard.py coverage.xml
# change your code somehow
# execute unit tests, collecting code coverage
# then verify that your code coverage has not decreased
ccguard.py --consider-uncommitted-changes coverage.xml
# if you are rather a visual person, check cc.html and diff.html
ccguard.py --html --consider-uncommitted-changes coverage.xml
# if needed to display the line coverage for each file in the HTML report,
# fine tune the source files path with the --repository argument
ccguard.py --html --consider-uncommitted-changes coverage.xml --repository src/
# allow regressions up to 3%
ccguard.py coverage.xml --tolerance 3
# allow regressions up to 10%, but never descend below 70%
ccguard.py coverage.xml --tolerance 10 --hard-minimum 70
# use the web adapter (ie. send the data to ccguard_server).
# requires a ccguard.server.address setting in the config.
ccguard.py coverage.xml --adapter web

please see [how-to-produce-code-coverage-data](docs/how to produce code coverage data.md) to know how to produce code coverage data in your favourite language.

display code coverage trends

What a better feedback loop than measuring the work you have accomplished?

python ccguard/ccguard_log.py

synchronize repositories

The use case being: you wish to use ccguard as pre-commit. Your team already has some references. Then you could be interested in sharing them.

# upload the report to a distant redis repository
python ccguard/ccguard_sync.py sqlite redis
# download the report from a distant redis repository
python ccguard/ccguard_sync.py redis sqlite
# limit to a single repository
python ccguard/ccguard_sync.py redis sqlite --repository_id abcd
# limit to a single repository and a single commit
python ccguard/ccguard_sync.py redis sqlite --repository_id abcd --commit_id ef12

launch a local server

ccguard server allows you to centralize the reports and the regression checks (useful for CI workflows) also serves coverage and diff reports.

python ccguard/ccguard_server.py

credits

  • Alexandre Conrad for his wonderful pycobertura
  • all the beta testers for their precious feedback

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

ccguard-0.2-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file ccguard-0.2-py3-none-any.whl.

File metadata

  • Download URL: ccguard-0.2-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.3

File hashes

Hashes for ccguard-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d4166574713817e495bbe18f5a9edc4ebe5160dbd4a50c4e0f665809ff51d3de
MD5 215c5aab2f60f3a6f1cdbbaf1a5bd8c7
BLAKE2b-256 b6856448400db2dd5a58e785ff5bdeac5a4fc9e0ae0f6df60d2f083d2224c131

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