robiningelbrecht / phpunit-coverage-check
该软件包已被弃用且不再维护。未建议替代软件包。
使用phpunit的clover或文本报告检查代码覆盖率
0.3.1
2019-10-14 07:04 UTC
Requires
- php: >=7.0.0
README
此PHP脚本将从phpunit读取clover xml报告并计算覆盖率得分。根据给定的阈值,如果覆盖率高于阈值则脚本正常退出,如果覆盖率低于阈值则脚本以代码1退出。此脚本可用于您的持续部署环境,例如添加到pre-commit钩子。
安装
可以使用composer安装此脚本。将此存储库作为依赖项添加到composer.json文件中。
composer require --dev robiningelbrecht/phpunit-coverage-check dev-master
使用方法
通过phpunit生成覆盖率文件并运行覆盖率检查脚本
vendor/bin/phpunit --coverage-clover clover.xml vendor/bin/coverage-checker clover.xml 80
可用参数和选项
Command coverage-checker, version 1.0 Check the code coverage using the clover or text report of phpunit Usage: coverage-checker [OPTIONS...] [ARGUMENTS...] Arguments: <file> The location of the file that's generated by phpunit <percentage> The coverage threshold that is acceptable. Min = 1, Max = 100 Options: [-f|--formatter] Formatter to use ("message" by default) [-p|--processor] Processor to use ("clover-coverage" by default) [-m|--enabled-metrics] Metrics to use when calculating coverage. Defaults to all [-elc|--exit-on-low-coverage] Exit the script when low coverage is detected. Defaults to "false" [-h|--help] Show help [-v|--verbosity] Verbosity level [-V|--version] Show version Legend: <required> [optional] variadic...