Skip to content

Cobertura reports ignoring closures when calculating executable lines #50

@may246

Description

@may246

Hello! I've noticed that the coverage values listed in the Cobertura reports generated by Xcresultparser do no match the coverage values reported by Xcode.

After doing some digging, it seems that the reason for this is that Xcode includesclosures when calculating executable lines, while Cobertura does not.

I can't show our actual code files, but here's an example of what I mean -- the XML data shows a single executable line, while Xcode shows three, including two closures.

Image
Image

In this minimal example, the final coverage percentage happens to not be impacted (since the coverage state of all three lines is the same anyway), but more often than not the final coverage ends up being significantly different due to the ignored closures. E.g., in another file with 688 executable lines according to Xcode, Cobertura only reports 451 lines 😬

I strongly suspect this issue isn't unique to Xcresultparser, since we saw similar problems with Slather and Xcov as well. But I'm wondering if it might be possible to fix this issue on the Xcresultparser side, because the correct percentages are actually already reported in Xcresultparser's HTML and markdown output types? Any input on this or other potential workarounds would be appreciated! Thanks.


Other Notes:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions