SonarCloud inline comment not appearing in BitBucket PR

Hello All,

This is in relation to seeing SonarCloud issues inline in BitBucket PR:

  • ALM used Bitbucket Cloud
  • CI system used Bitbucket Cloud - Private repo
  • Scanner command used when applicable
    Following directions at Bitbucket
    Maven command is:
    mvn -B -Djavacpp.platform=linux-x86_64 verify checkstyle:checkstyle pmd:pmd spotbugs:spotbugs org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
    Sonar version is:
    sonar-maven-plugin:3.9.0.2155:sonar
  • Languages of the repository Java
  • Private Repo
  • The Code Quality Gate overview widget is appearing fine. But there is nothing under the BitBucket “Reports” tab and no-inline comments
  • Steps to reproduce - Trigger BitBucket pipeline and wait for Sonar Analysis
  • Potential workaround - Unknown

Having access to SonarCloud reports in BitBucket will simplify our workflows significantly. Please advise.

Thanks,
Richard

The Code Report for a pull request is created as one of the last steps of processing a pull request analysis on SonarCloud. To be able to create the Code Report on your pull request on Bitbucket cloud, SonarCloud needs permission. It normally has that through the SonarCloud application installed in your Bitbucket cloud workspace. Normally this “just works”. Let’s check a few things.

When you trigger the pipeline, are you sure the pull request analysis completes successfully at SonarCloud side? Check on the Administration / Background Tasks page (on SonarCloud) that a new line appears for the pull request.

Does this happen for all pull requests the repository with this problem? For example what if you create a new pull request?

Does this happen for all repositories in your workspace?

How exactly did you create the project on SonarCloud side? Have you followed the steps as documented here or did you do it some other way? How?

If you imported your organization some other way, that could explain something missing in the connection configuration between Bitbucket and SonarCloud. Deleting and reimporting on SonarCloud would probably fix this problem (at the expense of losing the existing history, of course…).

Hello Janos,

Thanks for getting back.

There is a new line (Project Analysis) appearing in Administration / Background Tasks page (on SonarCloud) for each pull request.

On a visual inspection it looks as though a new line is being created for each trigger of the bitbucket pipelines. i.e. the same branch (not just pull requests) is appearing multiple times in Administration / Background Tasks.

This is a single repo.

It was a while ago, but I believe I followed the directions from the page you referenced as specified on Getting started with Bitbucket Cloud.

It looks like when deleting the organisation there is a notification the paid subscription plan will be stopped. Is it possible to delete the organisation without having to restart the subscription?

Much thanks,
Richard

On Bitbucket, if you go to Repository settings and then under SonarCloud the Settings, what do you see? (Does it say that “This repository is already bound to a SonarCloud project” or something else?)

Unfortunately that’s not possible. Subscriptions are linked to organizations, for now, so recreating the organization requires recreating the subscription…

That’s good, it shows that your project is indeed getting analyzed. (So the code reports should show up for pull requests.)

Just for the record.
In the new year of 2022 SonarCloud annotations have miraculously appeared in our PRs.
Thank you to whoever fixed the issue.

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