| Table of Contents |
Description / Features
The plugin enables analysis of Groovy projects within Sonar.
It leverages CodeNarc for coding rules violations, Gmetrics for cyclomatic complexity and Cobertura for code coverage.
Plugin | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 |
|---|---|---|---|---|---|---|
CodeNarc | 0.9 | 0.9 | 0.13 | 0.15 | 0.16.1 | 0.17 |
GMetrics | 0.2 | 0.2 | 0.3 | 0.3 | 0.4 | 0.5 |
cobertura-maven-plugin |
| 2.4 | 2.5 | 2.5 | 2.5.1 | 2.5.1 |
Installation
- Install the JavaScript plugin through the Update Center or download it into the SONAR_HOME/extensions/plugins directory
- Restart the Sonar server
Usage
A list of sample projects is available on github that can be browsed or downloaded:
- Groovy project analyzed with the Sonar Runner: /projects/languages/groovy/groovy-sonar-runner
- Groovy project analyzed with Maven: /projects/languages/groovy/groovy-maven
Sonar Runner
Create a sonar-project.properties file to configure your analysis with the Sonar Runner.
Here is an example of sonar-project.properties file.
Maven
If you project is built with Maven, you need to add the 'sourceDirectory' property to the build section of your pom:
and the sonar.language property to the properties section of your pom:
Here is an example of pom.xml file.
Advanced Usage
It is possible to reuse previously generated report from CodeNarc by setting the sonar.groovy.codenarc.reportPath property.
Known Limitations
The source directory must be added to the pom.xml, even if the project is built with Maven. This comes from the fact that Sonar does not call gmaven plugin.
Change Log
| Release 0.6 (8 issues) | |||||
|---|---|---|---|---|---|
| Type | Key | Summary | Priority | Status | Resolution |
|
|
SONARPLUGINS-2110 | Do not execute CodeNarc, if no active rules |
|
|
Fixed |
|
|
SONARPLUGINS-2108 | Groovy Plugin not compatible with SCM Activity Plugin |
|
|
Fixed |
|
|
SONARPLUGINS-2107 | Rename default quality profile to "Sonar way" to be consistent with other plugins |
|
|
Fixed |
|
|
SONARPLUGINS-1745 | Update to CodeNarc 0.17 and GMetrics 0.5 |
|
|
Fixed |
|
|
SONARPLUGINS-1707 | On Groovy projects, replace the "distribution of complexity by class" by the "distribution of complexity by file" |
|
|
Fixed |
|
|
SONARPLUGINS-1631 | Refactor the way how Groovy plugin handles resources |
|
|
Fixed |
|
|
SONARPLUGINS-1123 | Parsing GMetrics Report - Inner Classes leads to Exception and Termination of build |
|
|
Fixed |
|
|
SONARPLUGINS-597 | Inner classes are not properly handled by the plugin in GMetrics results parsing |
|
|
Fixed |
| Release 0.5 (3 issues) | |||||
|---|---|---|---|---|---|
| Type | Key | Summary | Priority | Status | Resolution |
|
|
SONARPLUGINS-1565 | Update to CodeNarc 0.16.1 and GMetrics 0.4 |
|
|
Fixed |
|
|
SONARPLUGINS-1404 | Update to cobertura-maven-plugin 2.5.1 |
|
|
Fixed |
|
|
SONARPLUGINS-596 | Error when parsing certain files for duplications |
|
|
Fixed |
| Release 0.4 (3 issues) | |||||
|---|---|---|---|---|---|
| Type | Key | Summary | Priority | Status | Resolution |
|
|
SONARPLUGINS-1359 | Update to CodeNarc 0.15 |
|
|
Fixed |
|
|
SONARPLUGINS-1205 | Update to CodeNarc 0.14 |
|
|
Fixed |
|
|
SONARPLUGINS-1159 | Some rule parameters were missed |
|
|
Fixed |
| Release 0.3 (11 issues) | |||||
|---|---|---|---|---|---|
| Type | Key | Summary | Priority | Status | Resolution |
|
|
SONARPLUGINS-1137 | Allow to import CodeNarc ruleset |
|
|
Fixed |
|
|
SONARPLUGINS-1108 | Update to cobertura-maven-plugin 2.5 |
|
|
Fixed |
|
|
SONARPLUGINS-1107 | No messages in violations |
|
|
Fixed |
|
|
SONARPLUGINS-1106 | Update to CodeNarc 0.13 |
|
|
Fixed |
|
|
SONARPLUGINS-872 | Groovy Plugin: Report path for sonar.groovy.codenarc.reportPath property is not read correctly |
|
|
Fixed |
|
|
SONARPLUGINS-871 | Groovy Plugin: Report path for sonar.groovy.gmetrics.reportPath property is not read correctly |
|
|
Fixed |
|
|
SONARPLUGINS-754 | Migrate to new rules api |
|
|
Fixed |
|
|
SONARPLUGINS-742 | Use cobertura parser provided by sonar-cobertura-plugin and surefire parser provided by sonar-surefire-plugin |
|
|
Fixed |
|
|
SONARPLUGINS-697 | Upgrade to CodeNarc 0.12 and GMetrics 0.3 |
|
|
Fixed |
|
|
SONARPLUGINS-621 | Add rules parameters |
|
|
Fixed |
|
|
SONARPLUGINS-620 | Cannot parse lineNumber "" |
|
|
Fixed |
| Release 0.2 (5 issues) | |||||
|---|---|---|---|---|---|
| Type | Key | Summary | Priority | Status | Resolution |
|
|
SONARPLUGINS-696 | NPE in CoberturaSensor, when parsing some reports |
|
|
Fixed |
|
|
SONARPLUGINS-692 | Report results of unit tests |
|
|
Fixed |
|
|
SONARPLUGINS-687 | Test files incorrectly handled by GroovySourceImporter |
|
|
Fixed |
|
|
SONARPLUGINS-672 | Migrate to sonar-dev-maven-plugin from sonar-dev-mojo for integration tests |
|
|
Fixed |
|
|
SONARPLUGINS-613 | Add coverage using Cobertura |
|
|
Fixed |
| Release 0.1 (4 issues) | |||||
|---|---|---|---|---|---|
| Type | Key | Summary | Priority | Status | Resolution |
|
|
SONARPLUGINS-582 | Integrate Gmetrics for standard metrics |
|
|
Fixed |
|
|
SONARPLUGINS-581 | Integrate CodeNarc coding rules engine |
|
|
Fixed |
|
|
SONARPLUGINS-580 | Create Groovy Plugin |
|
|
Fixed |
|
|
SONARPLUGINS-194 | Provide rules for groovy/grails with codenarc in sonar |
|
|
Fixed |

