Bitbucket cloud integration with sonar

That depends on your settings at the ALM side (Bitbucket in your case). This is completely outside SonarCloud.

like if i add sonar.bitbucket.approvalFeatureEnabled property then PR will not be approved in case of issues raised by Quality gate, but its not working.

Hi,

Could you share how you resolved your issue, this might be helpful for other users.

We do not support this property, it’s coming from an external provider.

You can prevent PR merge with a premium plan on BitBucketCloud.

Cheers

Hi @aurelie,

While scanning my PR output always shows 0 files indexed, it mens it is not scanning my PR.
How to debug this?

Sonarcloud is not scanning my PR code it always show 0 bugs , 0 Vulnerabilities.
Please the attached screenshot.

If you go to the Code tab of your PR on SonarCloud, do you see the files there that you expect to be analyzed, or not?

There is no code files under code tabs.
When I scan it through sonar scanner it always shows 0 files scanned.

Please refrain from messages like these. They don’t help you get responses any faster, and they are noise in the thread.

This is probably because the PR has no code changes compared to the base branch.

You can verify the list of changed files in the PR using this command:

git diff --name-only base-branch pr-branch

I expect the output will be empty, or the listed files are not considered code. What is considered code is configured when running the scanner. Maybe your scanner configuration is not correct. The main configuration properties are sonar.sources, sonar.inclusions and sonar.exclusions. The complete documentation is on the Narrowing the Focus page of our online documentation.

I want to scan my PR then how can i define sonar.sources in my command sonar.sources will look the code in the current directory not in the PR i think.

Difference is there between the branch but it is not able to scan my PR.

When you run a PR analysis, you must checkout the branch of the PR. The scanner works with the content in the current directory.

Block Merge via Merge Check in PR (Sonarcloud/BitBucket cloud)

searched for an answer to this prior to posting, but didn’t find anything specific about requirements to set up Merge Checks or Blocking-Merge on Failed Sonarcloud quality Gate.

Maybe you can have a look at this post

Cheers,