Discrepancies between coverage shown in Last Activity and the PR Summary

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
  • CI system used: Circle CI
  • orb: sonarsource/sonarcloud@2.0.0
  • Languages of the repository: Swift

Hello,

I was observing some discrepancies between SonarQube cloud > Overview > Last Activity and the PR Summary.

Case 1

For example, if I didn’t modify any executable lines in my project, the Last Activity reports a decrease of 0.1% in coverage:

Last Activity

PR Summary

Case 2

Additionally, if I modify my code without covering it with tests, I observe that the coverage in the Last Activity becomes equal to +60%:

Last Activity

PR Summary

Case 3

Another thing that I saw was in another PR, the coverage is 91.2% and the estimated coverage after merge is 85.6%. However, the Last Activity show a decrease in coverage of 0.2%.

Last Activity

PR Summary

This could be related to:

Hi,

Welcome to the community!

That’s not actually what your PR Summary is showing. It says there are “not enough lines to compute coverage”, not that there are no lines.

Can you check the Measures tab of this PR to see exactly what (if anything) shows up under Size → New Lines?

What was the existing coverage on those modified lines? I’m willing to bet it was 60%. This isn’t looking at new coverage on changed lines, but total coverage.

That’s all perfectly possible. 91.2% is not 100%. Since it’s such a large change (2.2k New Lines to Cover is… a lot) I can easily imagine that dragging down overall coverage.

 
Ann