The CodeNarc Team is proud to announce the release of version 0.19.
CodeNarc <http://codenarc.sourceforge.net/> is a static analysis tool for
Groovy source code. Version 0.19 adds 13 new rules (bringing the total to
318 rules) and a bunch of bug fixes and enhancements. Check us out on GitHub
<https://github.com/CodeNarc/CodeNarc> !
New Rules
. #349: New EmptyClass rule (basic) - Reports classes without
methods, fields or properties. Why would you need a class like this?
. #409: New ClassNameSameAsFilename rule (naming) - Reports files
containing only one top level class / enum / interface which is named
differently than the file.
. #214: New ThisReferenceEscapesConstructor rule (concurrency) -
Reports constructors passing the 'this' reference to other methods. Thanks
to Artur Gajowy. (pull request #15)
. #340: New GrailsDomainReservedSqlKeywordName rule (grails) - Check
for Grails domain class with class or field name which is a reserved SQL
keyword. Thanks to Artur Gajowy. (pull request #13)
. #339: New GrailsDomainWithServiceReference rule (grails) - Check
for Grails domain class with reference to service class (field). Thanks to
Artur Gajowy. (pull request #12)
. #382: New JUnitPublicField rule (junit) - There is usually no
reason to have a public field (even a constant) on a test class.
. #407: New GStringExpressionWithinString rule (groovyism) - Check
for regular (single quote) strings containing a GString-type expression
(${..}).
. #417: New IllegalClassMember rule (generic) - Checks for classes
containing fields/properties/methods matching configured illegal member
modifiers or not matching any of the configured allowed member modifiers.
. #412: New EnumCustomSerializationIgnored rule (serialization) -
Checks for enums that define writeObject() or writeReplace() methods, or
declare serialPersistentFields or serialVersionUID fields, all of which are
ignored for enums.
. #421: SpaceAroundClosureArrow rule (formatting) - Checks that
there is whitespace around the closure arrow (->) symbol.
New "Enhanced Classpath" Ruleset: These rules require application classes on
CodeNarc's classpath:
. #329: New UnsafeImplementationAsMap rule - Reports incomplete
interface implementations created by map-to-interface coercions. By default,
this rule does not apply to test files. Thanks to Artur Gajowy. (pull
request #14)
. #364: New CloneWithoutCloneable rule - The method clone() should
only be declared if the class implements the Cloneable interface. Thanks to
Artur Gajowy. (pull request #14)
. #278: New JUnitAssertEqualsConstantActualValue rule - Reports
usages of org.junit.Assert.assertEquals([message,] expected, actual) where
the 'actual' parameter is a constant or a literal. Most likely it was
intended to be the 'expected' value..
Updated and Enhanced Rules
. #371: CouldBeElvis rule. Added support for IF statements without
braces.
. #408: SerialVersionUID rule: Also check that serialVersionUID
field is declared private.
. #414: Extend UnnecessaryIfStatement rule: if (condition){ return
true }; return false.
. #415: Extend IfStatementCouldBeTernary rule: if (condition) {
return 1 }; return 2.
. #416: Enhance JUnitAssertAlwaysSucceeds and JUnitAssertAlwaysFails
to catch String or number constant or List or Map literal passed in as
condition parameter; and add support for checking assertNotNull()..
Bug Fixes
. Fix bug in UnnecessaryDefInFieldDeclarationRule making it report
false positives with 'def' on right hand side of assignment
. #135: CoupledTestCase incorrect violation when referencing the
current class.
. #19: Fix BracesForMethod rule for single-line methods.
. #20: HTML Report Anchor Fix. Thanks to Jeff Beck.
. #137: Mistake in ExplicitHashSetInstantiationRule violation
message.
. #138: SpaceAroundOperators: Add violation for
isEcpr?processRecords(records[0]):''.
Framework and Infrastructure
. Added support for per-rule custom compilation phase, allowing for
more type information in AST when required. NOTE: New rules that use a later
compilation phase require that CodeNarc have the application classes being
analyzed on the classpath. This adds a new int getCompilerPhase() method to
Rule. Thanks to Artur Gajowy. (pull request #14)
. #419: Add maxPriority property to HTML and Text ReportWriters -
filter out lower priority violations.
Visit the CodeNarc Home Page <http://codenarc.sourceforge.net/>
|