Code Smell on user branch gets flagged as a bug on main branch once merged

Hi

Sometimes code smell on a user branch gets flagged as a bug on the main branch after the user branch gets merged into main. We want to understand what is the reason for this. Could you please help to understand the process here.

  • SonarQube Version Used - 9.9.2 LTE

Thanks
Priyanka

Hey there.

It would be probably be good if you gave us an explicit example (screenshots are great for this sort of thing) demonstrating the issue.

Hi Colin,
We see that this issue is intermittent. Also the issue happens once the branch gets merged to the main. We don’t have any proper screenshot that demonstrate this behaviour.

Hi Colin,

We faced the issue again, observed that there are no bugs for the user branch, but when merged there are 3 bugs. Please refer to the screenshots attached.

Okay! What are those 3 bugs? Click into “3 new bugs” and share what you see there.

It would also be good for you to check if those 3 bugs actually relate to changed lines in the user’s branch (and do you see them if you look at the Overall Code) of the user’s branch?

Hi Colin
The 3 bugs are uploaded as image.



Hi Colin,
Answering your question, yes the changes were related to changed lines in the users branch and I can also see them on the Overall Code of the user’s branch.

Hi Colin,

Could you please check and help us with this issue.

Thanks
Priyanka

It sounds like you need to make sure you use a Reference Branch New Code Period when analyzing your user’s branch, targeting the main branch.

As a result, those issues should appear in the New Code section of the user’s branch.

Thanks Colin, this suggestion worked. :slight_smile:

1 Like