Skip to: Site menu | Main content

A Grails-like Rich Internet Framework

Codenarc Plugin Print

Description

The CodeNarc Plugin provides static code analysis for Groovy code. It uses the CodeNarc library. It is actually a port of the Grails CodeNarc plugin created by Burt Beckwith.

Installation

The current version of griffon-codenarc-plugin is 0.2

To install just issue the following command

griffon install-plugin codenarc

Usage

The plugin provides a script 'codenarc' that will analyze your code and write its results to an HTML file. Run

griffon codenarc

to perform the analysis.

Customization

The plugin requires no customization to run. By default it will analyze all Groovy files in

  • src/main
  • griffon-app/controllers
  • griffon-app/models
  • griffon-app/views

    and use a default title and report name. You can restrict which folders are included or add extra ones. The following table lists settings that will be read from griffon-app/conf/Config.groovy and used if available:
Property Default Value Meaning
codenarc.reportName 'CodeNarcAntReport.html' the name of the analysis report file
codenarc.reportType 'html' the report type; the only valid value is 'html'
codenarc.reportTitle none the report title
codenarc.maxPriority1Violations unlimited the maximum number of Priority 1 violations allowed; more than this value fails the build
codenarc.maxPriority2Violations unlimited the maximum number of Priority 2 violations allowed; more than this value fails the build
codenarc.maxPriority3Violations unlimited the maximum number of Priority 3 violations allowed; more than this value fails the build
codenarc.ruleSetFiles 'rulesets/basic.xml,rulesets/exceptions.xml,rulesets/imports.xml,rulesets' a comma-delimited list of rule file names
codenarc.processSrcGroovy true whether to analyze source in src/main/*.groovy
codenarc.processControllers true whether to analyze source in griffon-app/controllers
codenarc.processModels true whether to analyze source in griffon-app/models
codenarc.processViews true whether to analyze source in griffon-app/views
codenarc.processTestUnit true whether to analyze source in test/unit
codenarc.processTestIntegration true whether to analyze source in test/integration
codenarc.extraIncludeDirs none extra source directories to include; for example to include Wizard files, specify
codenarc.extraIncludeDirs=['griffon-app/wizards']
to add the pattern 'griffon-app/wizards/*/.groovy' to the analysis fileset

History

Version Date Notes
0.2 09-09-09 Upgraded to codenarc 0.7
0.1 05-25-09 First release