FAQ
Which user permissions are needed for the User token configured when setting up a SonarQube™ server?
You can either use global or project-level permissions depending on the permission scope you want to allow and the features you want to use.
Global permissions
You need an Administer System permission in order to benefit from all the app features and to be able to use an automatic webhook for the app to receive scan results from SonarQube™.
Project permissions
You can restrict permission to project-level by granting your user Browse permission. However this means you have to set up a manual webhook when configuring your server.
Browse permission does not allow you to perform any action other than reading results (such as resolve issue or mark issue as a duplicate). In order to be able to perform these actions you need to add the Administer Issue permission. You also need Administer Hotspot permission if you want users to be able to change the status of hotspots.
Is there a way to get all of the Bitbucket projects and repositories that are using the app Include Quality for Bitbucket?
Using REST API
You can check which repositories are using the app actively by iterating over all your repositories in Bitbucket with GET /rest/api/latest/repos: https://developer.atlassian.com/server/bitbucket/rest/v804/api-group-repository/#api-api-latest-repos-get
Calling the app’s REST endpoint for each repository by https://{YOUR_BITBUCKET_SERVER}/rest/sonar4stash/1.0/projects/{projectKey}/repos/{repositorySlug}/settings
and checking for the property sonarEnabled
in the response:
{
project": {
"sonarEnabled": true,
...
}
}
Using Database
The table of the repo’s Sonar configuration is called AO_C716BC_REPO_CONFIG001
.
Query for the entries where Sonar is enabled:
select * from "AO_C716BC_REPO_CONFIG001"
where "SONAR_ENABLED" = TRUE
To get the repository with enabled Sonar configuration:
select PROJ.PROJECT_KEY, REPO.SLUG, * from "AO_C716BC_REPO_CONFIG001" as SONAR
join "repository" as REPO on REPO.ID = SONAR."REPO_ID"
join "project" as PROJ on PROJ.ID = REPO.PROJECT_ID
where "SONAR_ENABLED" = TRUE
Can I choose to only show the SonarQube™ analyses for certain branches?
Yes, you can restrict the app to show only analyses for branches with a name matching a certain pattern.
Follow these steps:
In Bitbucket go to your repository settings → Include Code Quality and click on “Use click on custom Repository settings”.
In the field “Restrict app to pull requests with match source branch”, add the regex you want analyzed branches to match.
SONAR™, SONARQUBE™ and SONARCLOUD™ are independent and trademarked products and services of SonarSource SA: see http://sonarsource.com , http://sonarqube.org , http://sonarcloud.io .