Unable to get code coverage for PR and sonar violation failure because of other PR changes

We are using Sonar Version 7.2 and currently we are facing two issues.

  • Implemented multi-branching code analysis using Dsonar.branch.name where we have a setup to pick up the respective PR and mater branches during code analysis. We don’t see code coverage measures for PR. Will the coverage supported in Sonar 7.2 version of PR which is in short lived branches ?

  • Other issue is we are seeing some violations for specific PR raised by user. By looking at the violation of the particular file changes are not part of the current PR changes. But the violations are coming from other PR. In that case we manually go to sonarqube mark the issues as “Resolve as won’t fix” . Please let me know how can i overcome these two issues?

I don’t know if this is a known issue for 7.2, but you should upgrade to 7.7. We made some major improvements to PR analysis (see announcement here). And I can confirm PRs have coverage support, as we use it daily :slightly_smiling_face:.

As for the violations belonging to a different PR, this can happen when you branch a PR from another, existing and unmerged PR. As long as the issues are not merged to the main branch (master in your case), they will show up in PRs that contains them. SQ doesn’t know if your existing PR will be merged before the current one, or if it will be abandoned. Hence, it needs to show these issues regardless of where they originally came from.

Thanks for the reply. I have resolved my issues.