Sonar SCM Stats Plugin

Feed SonarQube with Statistics about SCM system

License

License

GroupId

GroupId

org.codehaus.sonar-plugins
ArtifactId

ArtifactId

sonar-scm-stats-plugin
Last Version

Last Version

0.3.1
Release Date

Release Date

Type

Type

sonar-plugin
Description

Description

Sonar SCM Stats Plugin
Feed SonarQube with Statistics about SCM system
Project Organization

Project Organization

Patroklos PAPAPETROU
Source Code Management

Source Code Management

https://github.com/SonarCommunity/sonar-scm-stats

Download sonar-scm-stats-plugin

Dependencies

compile (9)

Group / Artifact Type Version
org.apache.maven.scm : maven-scm-api jar 1.8.1
org.apache.maven.scm : maven-scm-provider-svnexe jar 1.8.1
org.apache.maven.scm : maven-scm-provider-gitexe jar 1.8.1
org.apache.maven.scm : maven-scm-provider-hg jar 1.8.1
org.apache.maven.scm : maven-scm-provider-cvsexe jar 1.8.1
org.apache.maven.scm : maven-scm-provider-perforce jar 1.8.1
org.apache.maven.scm : maven-scm-provider-jazz jar 1.8.1
joda-time : joda-time jar 2.0
org.codehaus.plexus : plexus-utils jar 2.0.5

provided (3)

Group / Artifact Type Version
org.codehaus.sonar : sonar-plugin-api jar 3.6
org.codehaus.sonar : sonar-java-api jar 3.6
org.apache.maven : maven-project jar 2.0.9

test (2)

Group / Artifact Type Version
org.codehaus.sonar : sonar-testing-harness jar 3.6
junit : junit jar 4.10

Project Modules

There are no modules declared in this project.

SonarQube SCM Stats Plugin

Build Status Nemo Quality Gate status

Download and Version information: http://update.sonarsource.org/plugins/scmstats-confluence.html

Upgrade from 0.1 to 0.2 or later

If you upgrade from 0.1 to 0.2 or later you'll need to run a new analysis to see the Authors activity and commits per author widgets.

Description / Features

The plugin computes and feeds SonarQube with four new metrics : Commits / Author, Commits / Clock Hour, Commits / Week Day and Commits / Month. Five project widgets ( under the SCM category ) display these metrics using graphical representations.

Requirements

If you plan to use this plugin with non-Maven projects, or SCM access is available only with username/password or no SCM information is included in project's pom.xml you must also install the SCM Activity plugin ( http://docs.sonarqube.org/display/SONAR/SCM+Activity+Plugin ) .

Compatibility Matrix:

Plugin Version 0.1 0.2 0.3.1
Source Control
SVN Yes Yes Yes
Git Yes Yes Yes
Mercurial No Authors activity not supported see SONARPLUGINS-3108 Authors activity not supported see SONARPLUGINS-3108
Perforce No No Yes
CVS No Authors activity not supported see SONARPLUGINS-3104 Authors activity not supported see SONARPLUGINS-3104
Jazz No No Maybe

Installation

Install the plugin through the Update Center or download it into the SONARQUBE_HOME/extensions/plugins directory Restart the SonarQube server

Usage and Configuration

Set the SCM URL of your project (see SCM URL Format) by setting the sonar.scm.url property of SCM Activity plugin. For Maven projects this is automatically discovered if it's already set in pom.xml Set the SCM user / password (if needed) by setting the sonar.scm.user.secured and sonar.scm.password.secured properties of SCM Activity plugin Launch a new quality analysis and the metrics will be fed

Grabbing stats for multiple periods

Since version 0.2, the plugin allows the collection of SCM stats for multiple (1-3) periods. By default the plugin collects stats for the whole history (sonar.scm-stats.period1 = 0 days). You can have different periods on a global or project level by setting the number of days prior to the current date that the plugin will collect scm stats.

For example to collect scm stats for the last month, enter a value of 30, for the last week a value of 7, etc. The properties for period 2 (sonar.scm-stats.period2) and period 3 (sonar.scm-stats.period3) can have the value of zero(0) but the plugin will ignore it. Stats for the entire history of a project will be collected only if sonar.scm-stats.period1 property is set to zero(0). Negative values are ignored for all periods. You can edit widget properties by setting the period number (acceptable value are 1-3). By default each widget shows stats for period 1.

Ignoring / merging authors

Since version 0.3, the plugin allows you to set a list of authors to ignore (sonar.scm-stats.authors.ignore) and a list of author name synonyms to merge into single authors (sonar.scm-stats.authors.merge). If you want to set them using the project / global settings, add one author (ignored or merged) in each value. If you want to pass them as analysis arguments, authors must be comma-delimited. with aliases semicolon-delimited.

Example for ignored authors: -Dsonar.scm-stats.authors.ignore=author1,author2,author3

Example for merged authors: -Dsonar.scm-stats.authors.merge="author1=author;AUTHOR1,author2=author22;Author2;authOr2"

(Records for both "author" and "AUTHOR1" will be merged into "author1". Records for "author22", "Author2" and "auth0r2" will be merged into "author2")

Perforce Configuration

Perforce is supported since version 0.3 and you need to set the Client Spec name property (sonar.scm-stats.perforce.clientspec) in order to be able to get scm stats

Metrics Definitions

Name Key Description
Commits Per Week Day scm-commits-per-weekday Reports on the number of commits per week day.
Commits Per Week MOnth scm-commits-per-month Reports on the number of commits per week month.
Commits Per Clock Hour scm-commits-per-clockhour Reports on the number of commits per week clockhour.
Commits Per Week Author scm-commits-per-user Reports on the number of commits per week author.

Known Limitations

Drill-down from the average abacus complexity of a module/project does not work due to the following issue in SonarQube: SONAR-3233. Differential views are not implemented. Compatibility with VIEWS: as each project can define its own abacus, this plug-in does not compute the abacus complexity and distribution for a view.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Versions

Version
0.3.1
0.3
0.2
0.1