The plugin enables analysis of Groovy projects within SonarQubeTM.
It is compatible with the Issues Report plugin to run pre-commit local analysis.It leverages CodeNarc to raise issues against coding rules, Gmetrics for cyclomatic complexity and Cobertura for code coverage.
- Install the plugin through the Update Center or download it into the SONARQUBE_HOME/extensions/plugins directory
- Restart the SonarQubeTM server
Run an Analysis with the SonarQube
To run an analysis of your Groovy project, use the SonarQube TM Runner.
To display code coverage data:
- Prior to the SonarQube analysis, execute your unit tests and generate the Cobertura XML report.
- Import this report while running the SonarQube analysis by setting the
sonar.groovy.cobertura.reportPathproperty to the path to the Cobertura XML report. The path may be absolute or relative to the project base directory.
A sample project can be browsed or downloaded: TODO
It is possible to reuse a previously generated report from CodeNarc by setting the
The following piece of code won't be properly parsed because command expression is not currently supported.
Code Block language groovy
a = Arrays.asList 1,2,3,4,5
- If you're analyzing with Maven, the Groovy source directory must be added to the pom.xml
- explicitly, because SonarQube does not call the gmaven plugin.
It is no longer possible to:
- let SonarQube drive the execution of unit tests
- import unit test execution reports
- let SonarQube drive the execution of Cobertura; it is now only possible to import previously generated Cobertura report