Repository navigation
fix: a couple uncaught exceptions during coverage processing - #908
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #908 +/- ##
==========================================
- Coverage 97.99% 97.99% -0.01%
==========================================
Files 446 446
Lines 35634 35636 +2
==========================================
+ Hits 34920 34921 +1
- Misses 714 715 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
|
✅ All tests successful. No failed tests were found. 📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
Swatinem
left a comment
There was a problem hiding this comment.
For the eager json/xml parsing, we should maybe check that the contents start/end with {} or [] in case of json, or <> in case of xml.
I contemplated adding such a check before attempting a real parse, just to notice that we have a test that begins with a BOM which you can’t easily strip.
Maybe stripping trailing whitespace and then just checking that the file ends with ]} for json or > for xml would also work. Might be worth thinking about as a followup.
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.pychange 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.pychange 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 aReportEmptyErrorand set the appropriate error code.