-
Notifications
You must be signed in to change notification settings - Fork 31
Description
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.
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:
-
It looks like Sonar has the exact same issue as Cobertura: https://sonarsource.atlassian.net/browse/SONARSWIFT-560
-
Implicit closures and variable initialization expressions are also included in Xcode's calculation of executable lines:


