umbrellio/coverspector

This package helps to check that code coverage above minimum value. It can be useful in CI or git hooks.

1.4.0 2020-12-22 21:21 UTC

This package is auto-updated.

Last update: 2024-11-23 06:56:44 UTC


README

Github Status Coverage Status Latest Stable Version Total Downloads Code Intelligence Status Build Status Scrutinizer Code Quality

This package helps to check that code coverage above minimum value. It can be useful in CI or git hooks.

Features

  • Fail CI/hook when code coverage is less than minimal value.
  • Print list of uncovered files

Installation

Run this command to install:

composer require umbrellio/coverspector

Usage

Allow coverage toll to print info about uncovered files. In case of phpunit, add to phpunit config:

addUncoveredFilesFromWhitelist="true"

In case of codeception:

show_uncovered: true

In your CI, dump coverage output into file

vendor/bin/codecept run --coverage | tee coverage.txt

Than, run coverspector with minimum code coverage value

vendor/bin/coverspector --file=coverage.txt --min=100

If coverage will be less, coverspector will fail the job and print list of all not totaly covered files

CI Coverage Artifacts

If you still want to save coverage report as CI artifact - you should set

when: on_failure

in your CI config.

License

Released under MIT License.

Authors

Created by Makin Vladislav.

Contributing

  • Fork it ( https://github.com/umbrellio/coverspector )
  • Create your feature branch (git checkout -b feature/my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin feature/my-new-feature)
  • Create new Pull Request
Supported by Umbrellio