Format forcing does not bypass valid file check #125
Merged
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.
Problem
In v0.6.9, the Coverage.py
coverage
executable was not being used to parse the python-generated.coverage
file. With the release of v0.6.10, the Coverage.pycoverage
executable became required if attempting to parse a.coverage
file. If a user has a.coverage
file but does not have thecoverage
executable installed, then a debug error message is output informing them to either installcoverage
, or to convert the file tocoverage.xml
and force thecobertura
format.However, when forcing a format, the system still collects all possible coverage files across all file types, and passes them directly to the specified parser, bypassing the parser's
matches?
method that checks to make sure that the file is of a valid format. This is long standing behavior (and a long-standing bug), but did not surface until recently (coverallsapp/github-action#205), due to the fact that users ended up with both acoverage.xml
file and a.coverage
file in their directory, but were forcing thecobertura
format. The error occurred when the Cobertura parser tried to parse the.coverage
file.⚡ Solution
If a user specifies a format, then only the files that match the glob-pattern for the specified parser will be passed to the parser. In addition, the
matches?
method is no longer bypassed, which ensures that even if a file matches the correct naming pattern, there will be no attempt to parse it if the actual file format is incorrect.If a user specifies the
python
format for a.coverage
file, but does not have thecoverage
executable installed, then an error will be raised. If no format is specified, and the user has a.coverage
file but does not have thecoverage
executable installed, then a debug warning message only will be displayed.