Code coverage metrics are inconsistent

We have SQ running on our mixed Objective-C and Swift project.

In one of the latest reports we noticed an inconsistency in the Code Coverage metrics (see screenshot)
Screenshot 2021-09-09 at 15.37.26

Given the official Coverage calculation expression Coverage = (CT + CF + LC)/(2 * B + EL) we should get a coverage of (0+0+3426-484)/(2 * 0+3426)*100%=85.9% but in the report we see only 77.2%.

Although the coverage per each file individually seems to be consistent.

SonarQube Developer Edition - Version 7.9.6 (build 41879)


Welcome to the community!

First, your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.6 → 8.9.2 → 9.1 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your actual question, I can see where your Line Coverage value might seem off, but your math for total coverage indicates that you have no conditions at all in your code. So no ifs or elses, no while or do... while, no for loops… no boolean tests at all, and I find that hard to believe.

Anyway, if you still have questions after upgrade, feel free to come back to us.