Concern Regarding Sonar Comments Discrepancy Between Feature Branch and Master Branch

Hi Team,
We’ve observed a discrepancy in the Sonar comments workflow. Specifically, when we raise a request from a feature branch to the reference of the master branch (extracting the branch from master and implementing changes), we’re encountering a situation where no Sonar comments are generated. However, upon merging the reference branch to the master, we suddenly receive Sonar comments, which we had already addressed in our feature branch.

Can you please help me with your opinion?

Hi,

Welcome to the community!

Do you mean issues aren’t raised? On… the feature branch?

When you say you “addressed” them in the feature branch… does that mean you corrected the code?

 
Ann

Hi,
Thank you so much.
Do you mean issues aren’t raised? On… the feature branch?

Issue raised, but we fixed in our feature branch and then merge it to the reference of the master branch (extracting the branch from master and implementing changes)., but when we are merging reference into Master we are getting the comments for the issue which we already addressed.

When you say you “addressed” them in the feature branch… does that mean you corrected the code?

Yes. absolutely.

Hi,

So you’re saying that

  • issues are raised in a branch
  • you correct the code in the branch so that issues are no longer raised
  • you merge the branch into main
  • issues are re-raised in main

If that’s the case… then something went wrong with the merge? Or are you reporting false positives?

 
Ann

Hi,
Sorry for this, issues are not raised in a branch
Sonar check is available in pull request merging activity. So when we raised pull request, we didn’t get sonar comments but while merging the code to master - we are getting sonar comments related to that pull request.

Can you please help us with this query?

Please find the screenshot for your reference
image

Hi,

Thanks for the further explanation; I think I understand now. This is, unfortunately, a not-uncommon complaint. PR analysis only shows issues on lines that were changed in the PR. That means that for example if your PR deletes the only use of a private variable, the “unused variable” issue won’t be raised on the declaration in the PR because that line wasn’t changed in the PR. You’ll only see it after merge.

 
:frowning:
Ann

Hi,
Yes this is a uncommon issue, Could you please help me to fix the issue , Do we need to change or check any configuration in SonarQube 9.9.1 Developer edition?

Hi,

Unfortunately, there’s nothing you can do. It’s a known issue.

 
Ann

Hi,

So when can we expect the solution of this issue?

Hi,

I don’t have a timeline for you.

 
Ann