fix: a couple uncaught exceptions during coverage processing #908
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.
related to codecov/engineering-team#1520
i reviewed all of the uncaught exceptions during report processing. this PR addresses two of the highest-firing ones. others should be addressed but are more work and don't fire as frequently so i am punting on them
the
services/report/report_processor.py
change addresses a somewhat common uncaught exception:ValueError: invalid literal for int() with base 10: 'ignored'
. JSON-ified simplecov reports have "ignored" as a coverage value for skipped lines. we should convert those to -1 which is how the pyreport format represents skipped linesthe
services/report/languages/simplecov.py
change addresses the dominant uncaught exception during report processing:lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1
. the surrounding code is basically blindly attempting to parse it as JSON, and then attempting to parse it as XML, and then returning "it's a text file" if neither passes. so failing to parse it as XML is fine, we just weren't catching all the relevant exceptions. now we are. if these are truly empty files, i think they will no-op and if the overall upload has no non-empty files then we will return aReportEmptyError
and set the appropriate error code.