From 90fa2ee6ca3219ce62c8181dd2326c8c57e16b91 Mon Sep 17 00:00:00 2001 From: Matt Hammerly Date: Wed, 20 Nov 2024 15:15:29 -0800 Subject: [PATCH] fix: a couple uncaught exceptions during coverage processing --- services/report/languages/simplecov.py | 6 ++++++ services/report/report_processor.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/report/languages/simplecov.py b/services/report/languages/simplecov.py index 17e81028b..fa19723f2 100644 --- a/services/report/languages/simplecov.py +++ b/services/report/languages/simplecov.py @@ -37,6 +37,12 @@ def from_json(json: dict, report_builder_session: ReportBuilderSession) -> None: ) for ln, cov in enumerate(coverage_to_check, start=1): + if cov == "ignored": + # Lines that simplecov skipped are recorded as "ignored" by + # https://github.com/codeclimate-community/simplecov_json_formatter + # and we in turn record that as -1 which indicates a skipped line + # in our report + cov = -1 _file.append( ln, report_builder_session.create_coverage_line( diff --git a/services/report/report_processor.py b/services/report/report_processor.py index 275d320ae..3326168ab 100644 --- a/services/report/report_processor.py +++ b/services/report/report_processor.py @@ -129,7 +129,7 @@ def report_type_matching( processed = etree.fromstring(raw_report, parser=parser) if processed is not None and len(processed) > 0: return processed, "xml" - except ValueError: + except (ValueError, etree.XMLSyntaxError): pass return raw_report, "txt"