I am using SonarQube Developer Edition 7.9 and latest Bitbucket Server 6.6.1 with Branch Analysis and PR decoration enabled. This reports violations fine but I can’t find a way do prevent user from merging a PR with a failed Quality Gate.
SonarQube uses the CodeInsight API to post a report to Bitbucket. As per Bitbucket documentation, a failed report does not prevent a merge: https://developer.atlassian.com/server/bitbucket/how-tos/code-insights/ at the bottom.
Posting a failed report will not stop a pull request from being merged. There are build status settings that can be set up for a repository or project that will block the merge so it is recommended to also post a failed build status if wanting a report to affect the mergability of a pull request.
I suggest to add a configurable option to also push a success/failed build status to Bitbucket Server when a quality gate succeeded/failed for a PR analysis. This way the build status merge check can be used to prevent merging of a PR when the quality gate failed.