Must-share information (formatted with Markdown):
-
I use the following versions:
SonarQube: v9.3.0.51899
Scanner: sonar-scanner-4.5.0.2216-windows
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');
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/lcov.info',
}
},
() => 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?