SonarQube :: Bitbucket Plugin

Integration between Bitbucket and SonarQube

License

License

Categories

Categories

Wire Data Data Structures
GroupId

GroupId

com.wirelust.sonar.plugins.bitbucket
ArtifactId

ArtifactId

sonar-bitbucket-plugin
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

sonar-plugin
Description

Description

SonarQube :: Bitbucket Plugin
Integration between Bitbucket and SonarQube
Project URL

Project URL

https://github.com/teacurran/sonar-bitbucket
Project Organization

Project Organization

SonarSource
Source Code Management

Source Code Management

https://github.com/teacurran/sonar-bitbucket.git

Download sonar-bitbucket-plugin

Dependencies

compile (6)

Group / Artifact Type Version
com.wirelust.bitbucket.client : bitbucket-api-client jar 1.0
org.jboss.resteasy : resteasy-client jar 3.0.13.Final
org.jboss.resteasy : resteasy-jackson2-provider jar 3.0.13.Final
org.eclipse.jgit : org.eclipse.jgit jar 4.1.1.201511131810-r
commons-io : commons-io jar 2.4
org.apache.commons : commons-lang3 jar 3.3.2

provided (2)

Group / Artifact Type Version
org.codehaus.sonar : sonar-plugin-api jar 4.5.2
com.google.code.findbugs : jsr305 jar 2.0.3

test (5)

Group / Artifact Type Version
org.codehaus.sonar : sonar-batch jar 5.1
junit : junit jar 4.12
org.assertj : assertj-core jar 1.7.1
org.mockito : mockito-core jar 1.9.5
ch.qos.logback : logback-classic jar 1.1.2

Project Modules

There are no modules declared in this project.

SonarQube BitBucket Plugin

build status (jenkins) Maven Central Status License Badge

This is a fork of the SonarQube GitHub Plugin to offer the same functionality to BitBucket.

For BitBucket API calls, I have put together a client library here: https://github.com/teacurran/wirelust-bitbucket-api

Building

  1. Check-out wirelust-bitbucket-api

  2. build wirelust-bitbucket-api

    mvn install
  3. build this project:

    mvn package

Installation

The latest release can be found in maven central:

    <dependency>
        <groupId>com.wirelust.sonar.plugins.bitbucket</groupId>
        <artifactId>sonar-bitbucket-plugin</artifactId>
        <version>1.0</version>
    </dependency>

You can download the Jar file directly at:

http://repo1.maven.org/maven2/com/wirelust/sonar/plugins/bitbucket/sonar-bitbucket-plugin/1.0/sonar-bitbucket-plugin-1.0.jar
  1. copy the jar file to {SONAR_HOME}/extensions/plugins

  2. restart SonarQube

Usage

  1. Install plugin in Sonarqube

  2. Run sonar via maven in preview mode

    mvn clean sonar:sonar
        -Dsonar.analysis.mode=preview
        -Dsonar.bitbucket.login={YOUR_BITBUCKET_USER}
        -Dsonar.bitbucket.password={YOUR_PASSWORD}
        -Dsonar.bitbucket.repository={REPOSITORY_OWNER}/{REPOSITORY}
        -Dsonar.bitbucket.pullRequest={PULL_REQUEST_NUMBER}
        -Dsonar.bitbucket.client.id={BITBUCKET_CLIENT_ID}
        -Dsonar.bitbucket.client.secret={BITBUCKET_CLIENT_SECRET}
  3. You may have to disable some other plugins in order to get it to work, here are the settings I have to use:

    -Dissueassignplugin.enabeld=false
    -Dsonar.scm-stats.enabled=false
    -Dsonar.scm.enabled=false
    -Dsonar.bitbucket.repository=teacurran/intl-litpro
    -Dsonar.preview.excludePlugins=buildstability,devcockpit,pdfreport,report,views,jira,buildbreaker,issueassign,scm,scm-stats
    -Dsonar.issuesReport.console.enable=true

Parameters

Most of these options will appear in SonarQube in your global or project settings.

The only two settings that need to be passed in via maven are:

  • sonar.bitbucket.repository

  • sonar.bitbucket.pullRequest

Parameter name Description

sonar.bitbucket.login

Username for logging into BitBucket

sonar.bitbucket.password

Password for logging into BitBucket

sonar.bitbucket.apiKey

If you want to create pull request comments for Sonar issues under your team account, provide the API key for your team account here.

sonar.bitbucket.client.id

Bitbucket client id, required in addition to login

sonar.bitbucket.client.secret

Bitbucket client secret, required in addition to login

sonar.bitbucket.repository

Bitbucket repository in the format: owner/repository

sonar.bitbucket.pullRequest

Pull request ID you wish to analyze

sonar.bitbucket.threshold

Minimum issue severity in which a pull request can be approved. [BLOCKER, CRITICAL, MAJOR, MINOR, INFO] default: MAJOR

sonar.bitbucket.reportNotInDiff

Report on errors that are not caused by changes in the pull request. [true, false] default: true

sonar.bitbucket.ci.key

Key for the CI job, must be unique across all your jobs. defaults to "SonarQube"

sonar.bitbucket.ci.name

The name that appears on bitbucket for the build. defaults to "SonarQube"

sonar.bitbucket.ci.url

The url for the status. defaults to "http://sonarqube.org"

Versions

Version
1.0