Currently we use SonarQube Version 10.2.1 (build 78527).
For our Swift projects it works perfectly, until we discovered some weird Coverage percentages for merge requests. How does the calculation actually work and what is considered new code, for example, we don’t have a project version defined anywhere.
Our global settings seem to be this:
Any code that has changed since the previous version is considered new code.
Recommended for projects following regular versions or releases.
And when we open a merge request and then do a change again, is the version the last commit or what?
Our Coverage can go from 80% to 1% real quick after a new commit inside the merge request.
Do we have to change the settings to:
Choose a branch as the baseline for the new code.
Recommended for projects using feature branches.
The branch you select as the reference branch will need its own new code definition to prevent it from using itself as a reference.
To get better results for a merge request?
We use SonarQube Decoration, thats why we see those percentages drop sometimes when commiting new things.