Overall Warnings in short-lived branch

  • GitLab
  • Jenkins, Gradle Plugin
  • Command: gradle sonar (+ branch + Token)
  • Languages of the repository: Java
  • Error observed
    I’m currently migrating from SonarQube to SonarCloud and since I’m also migrating the SonarQube-Plugins to Gradle-Plugins, I have a lot of new warnings in files, I didn’t change. When I look in my feature-branch, everything looks great, but when I execute the exact same project to report to the master-branch, I then see the new warnings which are not related to the source-files I changed.

    Is there no possibility to see not only the warnings of the source-changes, but an Overall-view?

In SonarQube there is such a possibility. There I can switch between “new code” and “overall”

  • Steps to reproduce
    add gradle-Checkstyle-Plugin in short-lived branch
    execute gradle sonar for short-lived branch → no new warnings
    execute gradle sonar for main-branch → many new warnings
  • Potential workaround

Hey there.

If you click into the Main Branch, you should see the split between New and Overall Code as well.

Hi Colin
yes, but I want the same on my short-lived branch. Is this possible somehow?

No.

While SonarQube has collapsed short and long-lived branch into the same concept (just a branch), SonarCloud still works with short/long-lived branches where the former only raise issues on old code.

You could decide to set a pattern per-project to recognize all branches as long-lived branches which would at least mimic the behavior of SonarQube.

At some point (I don’t know when), SonarCloud will probably move towards the SonarQube model of a single branch concept.

ok, I saw that option, but it’s unclear to me, whether “new code” on long-lived branch is every single commit or all commits on that branch?
For main-branch I would prefer “every commit” as “new code”, but on all other “all commits on this branch” to have similar behavior to SonarQube.

And one more general question: I thought that SonarQube and SonarCloud only differ on hosting and 3rd party plugins, but now there’s also the short/long-lived branch handling. Are there any more differences?

They are different products, which have at time diverged from each other offering the same analysis engine, but some different features / implementations. I don’t have a comprehensive list of differences to share.

For end-user (developers) experience it’s still strange. Developers just want a SaaS to replace the self-hosted SonarQube and what they get is something else with only very limited information… I hope that both products will soon have almost equal features/implementations.

I agree with you. We hope to see more alignment in our products soon as we focus more on the Sonar solution, rather than individual products. This will take some time.