Description
Bug Report
The cobetura.xml
file generated does not contain the lines-covered
and lines-valid
attributes. According to https://stackoverflow.com/a/71116722/595220, the spec is at https://github.com/cobertura/web/blob/master/htdocs/xml/coverage-04.dtd which has
<!ATTLIST coverage lines-covered CDATA #REQUIRED>
<!ATTLIST coverage lines-valid CDATA #REQUIRED>
I haven't checked ll
To Reproduce
Add --cobertura-xml-report
to any MyPy invocation, grab the resulting XML file, and feed it to irongut/CodeCoverageSummary
@ GHA.
Expected Behavior
Spec-compliant tools shouldn't crash when presented with a MyPy-produced coverage XML report advertising its compatibility with the Cobertura standard.
Actual Behavior
Tools like the irongut/CodeCoverageSummary
action error out because of missing required XML attributes: irongut/CodeCoverageSummary#324. It fails upon checking for the presence of the lines-covered
attribute in the <coverage>
node with "Overall lines covered not found"
in this case. But I looked further into their source code, and I saw that it'd also choke on missing lines-valid
with "Overall lines valid not found"
.
I haven't checked any further but it might be a good idea to check the implementation against anything marked as #REQUIRED
in said DTD spec.
Extra research
Looking into https://github.com/python/mypy/blob/fe15ee6/mypy/report.py#L597, it seems to me that the values that could be mapped to the missing attributes are already present in the class and the mapping should be straightforward:
self.total_lines -> lines-valid
self.covered_lines -> lines-covered