Pull Request Analysis
Pull Request analysis is available as part of Developer Edition
Pull Request analysis allows you to:
- see your Pull Request (PR) analysis results in the SonarQube UI and see the green or red status to highlight the existence of open issues.
- automatically decorate your PRs with SonarQube issues in your SCM provider's interface.
PRs are visible in SonarQube from the "branches and pull requests" dropdown menu of your project.
When PR decoration is enabled, SonarQube publishes the status of the analysis (Quality Gate) on the PR.
When "Confirm", "Resolved as False Positive" or "Won't Fix" actions are performed on issues in SonarQube UI, the status of the PR is updated accordingly. This means, if you want to get a green status on the PR, you can either fix the issues for real or "Confirm", "Resolved as False Positive" or "Won't Fix" any remaining issues available on the PR.
PR analyses on SonarQube are deleted automatically after 30 days with no analysis. This can be updated in Configuration > General > Number of days before purging inactive short living branches.
Pull Request Analysis in SonarQube
These parameters enable PR analysis:
||The name of your PR
||Unique identifier of your PR. Must correspond to the key of the PR in GitHub or TFS.
||The long-lived branch into which the PR will be merged.
Pull Request Decoration
To activate PR decoration, you need to:
- declare an Authentication Token
- specify the Git provider
- feed some specific parameters (GitHub only)
The first thing to configure is the authentication token that will be used by SonarQube to decorate the PRs. This can be configured in Administration > Pull Requests. The field to configure depends on the provider.
For GitHub Enterprise or GitHub.com, you need to configure the Authentication token field. For Azure DevOps, it's the Personal access token.
Pull Request Provider
This is the name of the system managing your PR. In Azure DevOps, when the SonarQube Extension for Azure DevOps is used,
||SLUG of the GitHub Repo|
||The API url for your GitHub instance.
Note: if you were relying on the GitHub Plugin, its properties are no longer required and they must be removed from your configuration:
Bitbucket Cloud Parameters
||SLUG or UUID of the Bitbucket Cloud Repo|
||SLUG or UUID of the Bitbucket Cloud Owner|