Repository navigation
Conversation
A .cov file lists every file in the coverage scope. A file without executable lines gets an empty line list. Examples are interfaces, enums without methods, classes with only constants, and empty files. Clover and Cobertura inputs leave such files out, because the extractors skip entries without lines. The empty entries broke the check command: - check --verbose threw DivisionByZeroError. It prints the coverage percentage of each file, and FileCoverage::getCoveragePercentage() divides by the number of executable lines. - An empty (0-byte) PHP file threw ValueError in CoverageGuard, also without --verbose. range(1, 0) returns two line numbers for zero lines, so array_combine() got arrays of different sizes. CoverageProvider now skips entries without executable lines after the integrity checks, for every input format. Such a file has nothing to cover, so no rule can report it. The "analysed N files" count is now the same for all formats. Co-Authored-By: Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
.covfile lists every file in the coverage scope. A file without executable lines gets an empty line list:Clover and Cobertura inputs leave such files out, because the extractors skip entries without lines. With
.covinput, the empty entries breakcheck:check --verbosethrowsDivisionByZeroError. It prints the coverage percentage of each file, andFileCoverage::getCoveragePercentage()divides by the number of executable lines. Without--verbose, nothing calls this method.ValueError, also without--verbose.range(1, 0)returns two line numbers for zero lines, soarray_combine()inCoverageGuardgets arrays of different sizes.Now
CoverageProviderskips entries without executable lines, for every input format. It skips them after the integrity checks, so a missing file is still reported. Such a file has nothing to cover, so no rule can report it. The "analysed N files" count is now the same for all formats: the same PHPUnit run gave 2 files for Clover and 5 files for.cov..covfile, with and without--verbose. Onmaster, it throwsDivisionByZeroErrorandValueError.ProcessedCodeCoverageData, sotests/CoverageGuardTest.phpjoins the existing PHPStan ignore for internal php-code-coverage classes.Co-Authored-By: Claude Code