Send Sonar Analysis to Bitbucket after visualization on the SonarQube server

Must-share information (formatted with Markdown):

  • I use the following versions:
    SonarQube: v9.3.0.51899
    Scanner: sonar-scanner-
    NPM module: sonarqube-scanner - npm

  • What I am trying to achieve:
    I want to get the results from SonarQube in Bitbucket so on top of them I can perfrom Pull Requests, but it has to be automatic for any already existing or new repository in Bitbucket, without the need of manually adding repositories to the SonarQube server.

  • What I have tried so far:
    Since I have several Angular projects, I use the above given NPM package to run the installed on the PC scanner and then push the analysis to the SonarQube server. In future, this will be made with Jenkins (as per plan). This is the script file containing the configuration for the scanner used in the project which shows everything without issues in the SonarQube server after execution:

const scanner = require('sonarqube-scanner');

    serverUrl : 'https://.../sonar',
    options: {
      /* Meta Information */
      'sonar.projectKey': '...',
      'sonar.projectName': '...',
      'sonar.projectDescription': '...',
      'sonar.links.scm': 'https://bitbucket.../.../.git',
      /* Source Code */
      'sonar.sources': 'src',
      'sonar.sourceEncoding': 'UTF-8',
      'sonar.exclusions': 'node_modules/**',
      'sonar.tests': 'src',
      'sonar.test.inclusions': '**/*.test.ts',
      'sonar.javascript.lcov.reportPaths': 'coverage/',
  () => process.exit()

So my question is: how can I automate this process, so after I submit the results to the SonarQube server I get them as well in the Bitbucket scm without manually importing projects on the server?

Hey there.

  • What edition of SonarQube are you using?
  • What exactly are you expecting to see in Bitbucket?

Hello Colin,

I am using the Developer edition and what I am expecting to see is presented on this picture:

As you can see in the right part of the screen, on the blurry section is written “SonarQube” as integration.