Skip to content

Concepts

Scott Dutton edited this page Oct 7, 2017 · 4 revisions

Coverage

This tool tracks coverage of a pull request. This changes based on the input.

For phpunit

phpunit only considers lines with code on, This comes back in the clover file, so a more accurate measure can be used.

For example, 15 lines have changed, 5 lines in tests, 10 lines in source. 6 of these lines had code them 4 of them were just whitespace.

If 1 line of code did not have a test, 1/6 lines are not covered = 84% coverage (5/6 lines)

For other tools

Other tools which only provide the lines which do not comply have a differnt calculation method.

Same example as above, all of the lines are now considered, so 1/15 is not covered = 93% covered (14/15 lines)

Minimum coverage

When using the minimum coverage, the build will fail if below the number (exit code > 0) or show in the output itself it has failed.

Eg if the diff coverage is 93%, a minimum of 90% would pass this build, a minimum of 95% would fail this.

The minimum is passed in as follows

diffFilter --phpcs diff.txt phpcs.json 95

95 in the above example would be the minimum. If no minimum is provided a minimum of 100% is assumed. This means there has to be 0 lines with a violation on it

Clone this wiki locally