Bitbucket cloud integration with sonar

Hi Team,

Sonarqube is giving me error while pull request decoration.

I want sonarqube to analyse PR and add comment to bitbucket cloud to that particular PR.

But sonarqube giving me error that pull request decoration fail.

hello, what your logs are saying ?

Logs gives success output, and also sonar adds comment on my PR , but the problem is sonar is not scanning by PR code.

I am using sonar cloud.

Well, to be fair, your issue is not clear at all. You are speaking of SonarQube, later of Sonarcloud. Then you say you code was not analysed, but you got comments anyway : that’s not possible, what are the comments about if there is not analysis ?

Let me clarify, first i have used Sonarqube developer edition which has PR analysis later i came to know by your support team that sonarqube doesn’t suppoert integration with bitbucket cloud.
They told me use Sonarcloud for that.

So i switched to sonarcloud for PR analysis with bitbucket cloud.

And now issue is that running sonar scanner for pull request analysis it do add comment to my PR and it analysing my PR code.

I have already clarified my requirement with your team that what my organisation want and later they telling me that bitbucket cloud integration is not possible.

And now i want to know that how can achieve this.

Any more clarification needed?

Do let me know.

Can anyone update on this?

SonarCloud’s PR decoration adds a Quality Gate status to your PR but not scanning the PR code.

Kindly assist.

no scanning = no PR decoration. You can’t have a PR QG status without analysis. Please clarify your issue.

You are not getting my issue.

I had already clarified you in early messages and my issue I simple that sonar not scanning my PR code.

This is my issue as simple as that.

How can I explain more than this?

At least tell me how troubleshoot my issue.

Replying after 12 hr and saying not getting your issue doesn’t solve this.

Please tell me how to troubleshoot this issue.

Just tell me how to do PR decorations.

The steps, my application is python based.

This is a community forum. There is no SLA here, and nobody have to answer you. I’ll close this as you are being rude. Next time review the forum FAQ before posting. About PR decoration, start by reading the official documentation.

3 Likes

Hi @Vibhor_Malhotra,

Let’s try to start fresh here and try to understand ourselves :slight_smile:

First of all, it seems to me that you are expecting the detail of the issues directly in your files in BitBucketCloud, we don’t do that yet but it’s in our plan. We only have a SonarCloud quality widget to display PR metrics in the PR in BitBucket Cloud.

If it was not your expectation and before we can help you, can you clarify the following points :

  • What CI are you using ? (Bitbucket pipelines, …)
  • In SonarCloud, can you see your PR and a link to the PR in BitBucketCloud, like this :
  • In BitBucketCloud, can you see the SonarCloud quality widget like this :

Cheers

1 Like

Hi @aurelie,

My CI tools is jenkins and PR link is visible in sonarcloud UI.

And currently iam scanning my PR with sonar-scanner command.

So were you expecting detail of issues in BitBucketCloud diff files or you don’t see the widget in BitBucketCloud?

I do see the details on bit bucket cloud but there is no issue no code smells and the code button on bitbucket shows no code.

I think it is not scanning my code but only adding widget on bitbucket.

What details do you see?

By “code button”, I wonder if you mean that there is a Code label, and nothing under it. If that’s the case, it can happen due to some browser plugins, for example ad blockers. Try to disable browser plugins and reload the page, or try the page in an incognito window.

An easy way to find what was scanned is to visit your project on SonarCloud, and look at the Code tab. The files and directories you see there, are there because they were scanned, as per your project and configuration.

Hi,

Can you please tell that how run this command.
I am running this command on one of my servers and it scans the file which is present on that particular directory.
Below is my command.

sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=XXXXXXXX -Dsonar.projectKey=XXXXXXXXXX -Dsonar.organization=XXXXXXXXXXX-Dsonar.pullrequest.base=development -Dsonar.pullrequest.branch=release -Dsonar.pullrequest.key=2533

And this command is scanning the code which is present on the directory but not the PR of bitbucket. cloud.

Hi,

My above mentioned issue is solved.

Can you please also tell me that if any PR analysis failed then no one can approve that particular PR.