I’ve recently integrated SonarCloud into a Swift project, and I’m finding that there is a large discrepancy between a PR’s “Estimated coverage after merge” value and the overall coverage of the main
branch.
My main branch is listing a 66.6% overall coverage, with 1,580 uncovered lines. A recent pull request I did strictly for illustrative purposes adds 28 new lines, and has a coverage of 32.1% - however, it shows “83.5% Estimated after merge”, and there’s obviously no way that merging this PR will change the overall coverage number in any way but down, it’s not going to jump up by nearly 17%!
There are several other topics effectively with this same question (like How does SonarQube calculate estimated code coverage after merge? and How does Sonarqube calculates "Estimated after merge" for every PR?) but none of those get to any kind of actionable conclusion - they’re typically just left hanging with a question back to the OP and no answer of any kind.
I’ve verified that my main merge analysis and PR branch analysis use the same settings for base dir, exclusions, other settings - they are identical except for the branches being specified. The only odd thing about my setup that I can think of is that I’m running the analysis from Xcode Cloud, which is less than ideal (it’s not really setup to do this). However, even though it is called a bit weird, they are both being done in the exact same way, with the only exception of calling a different Fastlane function to specify the branch.
Any suggestions for what to look at to figure out where this discrepancy is coming from?