Last updated by admin 1 year ago
grails install-plugin gmetrics
Last updated by scryan7371 1 year ago
Gmetrics Plugin
The Gmetrics Plugin provides static code analysis for Groovy code. It uses the
Gmetrics] library.
The GMetrics project provides calculation and reporting of size and complexity metrics for Groovy source code. GMetrics scans Groovy source code, applying a set of metrics, and generates an HTML report of the results.
Total and average values for the following metrics are provided:
- Cyclomatic Complexity.
- ABC Size/Complexity. Also see the C2 Wiki page.
- Lines per method
- Lines per class
Installation
To integrate the plugin into your application just run the 'install-plugin' Grails script, e.g.
grails install-plugin gmetrics
Usage
The plugin provides a script 'gmetrics' that will analyze your code and write its results to an HTML file. Run
to perform the analysis.
Customization
The plugin requires no customization to run. By default it will analyze all Groovy files in
- src/groovy
- grails-app/controllers
- grails-app/domain
- grails-app/services
- grails-app/taglib
- grails-app/utils
- test/unit
- test/integration
and use a default title and report name. You can restrict which folders are included or add extra ones. The (optional) "gmetrics.properties" file can be located in the project base directory. The following table lists settings that will be read from grails-app/Config.groovy and used if available:
| Property | Default Value | Meaning |
|---|
| gmetrics.outputFile | target/GMetricsReport.html | the path and name of the analysis report file |
| gmetrics.reportType | org.gmetrics.report.BasicHtmlReportWriter | the report type; valid values are 'html', 'xml' and 'text', or the fully-qualified class name of a ReportWriter class |
| gmetrics.reportTitle | GMetrics Report | the report title |
|
| gmetrics.processSrcGroovy | true | whether to analyze source in src/groovy |
| gmetrics.processControllers | true | whether to analyze source in grails-app/controllers |
| gmetrics.processDomain | true | whether to analyze source in grails-app/domain |
| gmetrics.processServices | true | whether to analyze source in grails-app/services |
| gmetrics.processTaglib | true | whether to analyze source in grails-app/taglib |
| gmetrics.processTestUnit | true | whether to analyze source in test/unit |
| gmetrics.processTestIntegration | true | whether to analyze source in test/integration |
| gmetrics.extraIncludeDirs | none | extra source directories to include; for example to include Quartz job files, specify gmetrics.extraIncludeDirs=['grails-app/jobs'] to add the pattern 'grails-app/jobs//*.groovy' to the analysis fileset |
See
GMetrics for more information on
Gmetrics configuration options.
Please report any issues to the Grails User mailing list and/or write up an issue in JIRA at
http://jira.codehaus.org/browse/GRAILSPLUGINS under the Grails-Gmetrics component.
License
Licensed under the Apache License, Version 2.0. See
http://www.apache.org/licenses/LICENSE-2.0.
History
- January 11, 2011 (Version 0.3.1)
- Change default target to gmetrics from default
- August 11, 2010 (version 0.3)
- Support for version 0.3 of gmetrics
- Change dependency to provided so it is no longer packaged in the war
- June 3, 2010 (version 0.2.1)
- Support for report name and output file name as configurable parameters
- June 1, 2010 (version 0.2)
- released initial version 0.2
Last updated by admin 1 year ago