SonarQube Community Plugin Pull Request Request Analysis
Version Compatibility
Table of Contents
- Introduction
- Features
- Installation
- Configuration
- Usage
Introduction
This document provides detailed information about the installation and usage of the SonarQube Community Branch Plugin from the GitHub repository mc1arke/sonarqube-community-branch-plugin.
Url :https://github.com/mc1arke/sonarqube-community-branch-plugin
Features
- The SonarQube Community Branch Plugin adds branch and pull request support to SonarQube Community Edition.
- The PR decoration feature allows SonarQube code scans to be added as analyses within Merge Requests.
- Another feature is the ability to add an unlimited number of repositories if your organization uses multiple platforms like Git, GitLab, and Azure.
Installation
Step 1: Download the Plugin
Find and download the plugin compatible with your current SonarQube version from the release package below.
Get Sezer Darendeli’s stories in your inbox
Join Medium for free to get updates from this writer.
Release 1.19.0 · mc1arke/sonarqube-community-branch-plugin
Step 2: Add the Plugin to the SonarQube Plugins Folder
After downloading the sonarqube-community-branch-plugin-X.Y.Z.jar file, copy it to the opt/sonarqube/extensions/plugins folder on your SonarQube server.
Step 3: Add the Plugin to the SonarQube Agent
Open the opt/sonarqube/conf/sonar.properties file in your SonarQube installation and add the following lines:
sonar.web.javaAdditionalOpts=-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.17.1.jar=web
sonar.ce.javaAdditionalOpts=-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.17.1.jar=ceStep 4: Restart the SonarQube Service
Restart the service with the following command:
systemctl restart sonar.serviceConfiguration
After the plugin is installed and SonarQube is restarted, follow the configuration steps for branches and pull requests:
In the screen shown below, you can add multiple GitLab,Github repositories to the DevopsPlatform section.
Usage
Analyzing Branches
To specify a branch during analysis, add the following parameter to the SonarQube Scanner command line:
-Dsonar.branch.name=<branch_name>Analyzing Pull Requests
For pull request analysis, use the following parameters:
-Dsonar.pullrequest.key=<pr_key> -Dsonar.pullrequest.branch=<pr_branch> -Dsonar.pullrequest.base=<target_branch>Example for .NET Analysis:
To run an analysis for a .NET project, use the following command:
dotnet-sonarscanner begin /k:"project_key" /d:sonar.login="your_token" /d:sonar.pullrequest.key="123" /d:sonar.pullrequest.branch="feature_branch" /d:sonar.pullrequest.base="master"
dotnet build
dotnet-sonarscanner end /d:sonar.login="your_token"Question: How do I update the plugin? Answer: Simply download the new version, update the existing jar file in the extensions/plugins folder, and restart SonarQube.
This document provides basic information on the installation, configuration, and usage of the SonarQube Community Branch Plugin. For more detailed information and updates, please visit the GitHub repository.
Note: This article is for informational purposes only and is not intended for any commercial use. I declare that I am not responsible for any consequences arising from this article.









