Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format forcing does not bypass valid file check #125

Merged
merged 10 commits into from May 20, 2024

Conversation

littleforest
Copy link
Collaborator

@littleforest littleforest commented May 2, 2024

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.py coverage executable became required if attempting to parse a .coverage file. If a user has a .coverage file but does not have the coverage executable installed, then a debug error message is output informing them to either install coverage, or to convert the file to coverage.xml and force the cobertura 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 a coverage.xml file and a .coverage file in their directory, but were forcing the cobertura 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 the coverage executable installed, then an error will be raised. If no format is specified, and the user has a .coverage file but does not have the coverage executable installed, then a debug warning message only will be displayed.

@littleforest littleforest changed the title Fix issues with cobertura parser and coverage dir Format forcing does not bypass valid file check May 2, 2024
Copy link

coveralls-official bot commented May 2, 2024

Pull Request Test Coverage Report for Build 8931836762

Details

  • 16 of 16 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 93.971%

Totals Coverage Status
Change from base Build 8804286293: 0.07%
Covered Lines: 904
Relevant Lines: 962

💛 - Coveralls

Copy link
Contributor

@mike-burns mike-burns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great solution, thanks for figuring out those tests too.

Comment on lines +28 to +29
rescue error : ParserError
raise error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@afinetooth afinetooth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Mike, great solution. Thanks so much. Looks good to me.

@littleforest littleforest merged commit 8d5f1d4 into master May 20, 2024
11 checks passed
@littleforest littleforest deleted the fix-issues-with-cobertura-parser-and-coverage-dir branch May 20, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants