Comments are not Traversing branches with New Code Scan

Hello Team,

We are currently using the 8.9 sonarQube with the New Code Definition and I am experiencing a major issue, below I’ll explain the process:

I have the following Branches:

  • Master
    • Release1
      • Feature1
        • Resolve-Feature1

In Sonar I only have a reference of Master branch initially.
I have configured the master to be “Previous Version” for the initial scan.
The project setting for New code is Reference Branch “Master-main”

In our CI/CD Process, we do have different targets branch in PR’s,

Release1:

  • Feature1: changed a Class1,
    • Scanned the branch with reference branch Master:

      • this has introduced an issue based on New Code
      • I added a comment on the issue
    • Created a branch from Feature1 called: Resolve-F1-Rel1 :

      • Created a PR from Resolve-F1-Rel1 to Release1
        • Scanned the new branch
          • Class1 is introduced as an Issue
          • The previous comment from the original Feature is not traversing, I don’t see it
    • I merged the PR from Resolve-F1-Rel1 to Release1

      • Re scanned the Resolve-F1-Rel1, but still the comments are not synched.
      • I even scanned the release branch and then scanned Resolve-F1-Rel1, but not luck.
      • I created a new Feature2 from Release
      • Scanned the Feature, but the previous comments from the Release are not displayed in the feature.

One more thing, Will reverting to 7.9 which was our initial version, and use only specified changed files in the scan solve the issue? I believe yes?

To sum up: How can we make the comments on the issues traverse the different branches because without this you have to go every time in different target branches and re comment or mark as won’t fix ( duplicate task)
@dmeneses in case you have an idea :slight_smile:
Much appreciated,

Hi,

Branches have an isolated issue lifecycle, meaning that changes done to an issue in one branch won’t be copied to the same issue in a different branch.
For pull requests, SonarQube tries to guess that a “merge” was done. When a new issue shows up in a branch X and there’s a pull request Y that targets X with the same issue, the issue state is copied to the branch X.

Hello,

Thank you for your reply, OK I got this point.

What about the behavior from 7.9, we had all this branches setup and we used to pass the branch.name and branch.target, then the result was: comments on issues were traversing different branches.

Thanks

Sorry for the late reply, I missed your post.

In 7.9 short lived branches worked in a similar way to pull requests.

Hi @dmeneses,
Thanks for the reply, I ended up doing PR scan in 8.9 with a master always as a target, it solved the issue, comments are traversing.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.