Hi,
maybe somebody has an idea how the handle the following scenario (using SonarQube Enterprise 2025.1):
We are working with feature branches and a quality gate checking new code. These branches are analysed with a merge request analysis, using the master as reference branch for new code.
The master itself is then analysed with a branch analysis, new code is set to “previous version” here.
With this process, we should be able to identify new issues on the branches, can fix/accept them, and have a green analysis on the master.
But there are faling master analyses, because of new issues on unchanged lines:
- last usage of an import, parameter or private method was removed.
- deprecations because of dependency updates.
- too many levels of inheritance because of an dependency updates.
- etc.
(1) These issues cannot be found by a merge request analysis, as the affected lines are not contained.
(2) They as well cannot be found by a branch analysis using a reference branch, as the affected lines are not contained in new code.
(3) They can be found by a branch analysis with some other new code definition.
When using option (1) or (2), the issue status “accepted” is as well applied to the master on merging the branch.
When using option (3), the issues will occur on the master as well and have to be accepted again (after a failed analysis)
So we can either choose to not find these issues, or we can find but not accept them, both leads to a failed analysis on the master.
In an ideal world (i.e. having a clean code base) we should probably use option (2) and add “overall code” to our quality gate. We would then find these issues and their status would be applied to the master as well.
But sadly our code base is far from ideal (very old and huge), so there are many existing issues in overall code. So adding overall code to the quality gate is not an option.
It would be great to hear some suggestions on this! Thanks!
Regards,
Carsten