[Codenarc-user] [ANN] CodeNarc 0.10 and Updated Grails CodeNarc Plugin
Brought to you by:
chrismair
From: Chris M. <chr...@ea...> - 2010-10-04 01:48:34
|
CodeNarc <http://codenarc.sourceforge.net/> is a static analysis tool for Groovy source code. Version 0.10 includes: Bug Fixes * Fix Bug #3071531: "Unused rules don't recognized method closures" (e.g. return this.&bar;). https://sourceforge.net/tracker/?func=detail <https://sourceforge.net/tracker/?func=detail&atid=1126573&aid=3071531&group _id=250145> &atid=1126573&aid=3071531&group_id=250145. * Fix: UnusedPrivateField: Don't produce violation if field is a Closure field and is invoked. * Fix: ImportFromSamePackage: Causes violations for alias imports within same package. New Rules * New UnnecessaryIfStatementRule (basic): Checks for if statements where the if and else blocks are only returning true and false constants. if(x) { return true } else { return false }. * New UnnecessaryBooleanExpressionRule (basic): Check for unnecessary boolean expressions, including ANDing (&&) or ORing (||) with true, false, null, or Map/List/String/Number literal. Also checks for negation of true, false, null, or Map/List/String/Number literal. * New BigDecimalInstantiationRule (basic): Avoid creating BigDecimal with a decimal (float/double) literal; use a String literal instead. * New UnusedObjectRule (unused): Checks for object allocations that are not assigned or used. * New UnusedArrayRule (unused): Checks for array allocations that are not assigned or used. * New ImplementationAsTypeRule (design): Checks that particular classes are never used as types in variable declarations, return values or parameters, such as ArrayList, HashSet, Hashtable, PriorityQueue, etc. (design) * New JUnitUnnecessaryTearDownRule (junit). Checks for tearDown() methods that only call super.tearDown(). * New JUnitUnnecessarySetUpRule (junit). Checks for setUp() methods that only call super.setUp(). New Features and Infrastructure * CodeNarc now requires Groovy 1.6 or later to run. Keep in mind that it can still run against (analyze) older Groovy code. * New InlineXmlReportWriter (from Robin Bramley) for improved integration with the Hudson Violations plugin. See http://wiki.hudson-ci.org/display/HUDSON/Violations. * Upgrade to GMetrics 0.3 for AbcComplexityRule and CyclomaticComplexityRule. Violations now include line number and source line. * All JUnit rules (JUnit*Rule): Also apply to classes with names ending in *TestCase. * Add codenarc create-rule script to create a new rule and associated classes/tests (from Hamlet D'Arcy). * ConstantTernaryExpressionRule and ConstantIfExpressionRule: Also flag constant Map and List expressions. * GrailsPublicControllerMethod: add ignoreMethodNames property. Grails CodeNarc Plugin Updated * The Grails CodeNarc Plugin ( <http://grails.org/plugin/codenarc> http://grails.org/plugin/codenarc ) has also been updated to version 0. 7, to upgrade to CodeNarc 0. 10. Plugin changes include: * Add support in "Config.groovy" for using a custom "codenarc.properties". Set an optional property: e.g. codenarc.propertiesFile = "file:grails-app/conf/codenarc.properties". <http://codenarc.sourceforge.net/> http://codenarc.sourceforge.net <http://grails.org/plugin/codenarc> http://grails.org/plugin/codenarc |