Looking for the latest version? Download CodeNarc-0.26.0.jar (4.3 MB)
Home / codenarc / CodeNarc Version 0.21
Name Modified Size Downloads / Week Status
Parent folder
Totals: 3 Items   27.3 MB
CodeNarc-0.21-bin.zip 2014-04-23 15.3 MB 0
README.txt 2014-04-23 19.5 kB 0
CodeNarc-0.21-bin.tar.gz 2014-04-23 11.9 MB 0
CodeNarc ------------------------------------------------------------------------------- http://www.codenarc.org Changes in version 0.21 (April 2014) ------------------------------------------- NEW RULES - #30: GrailsMassAssignment rule (grails) - Checks for mass assignment from a params Map within Grails domain classes. (Thanks to Brian Soby) - #38: NoWildcardImports rule (imports) - Wildcard imports, static or otherwise, should not be used. (Thanks to Kyle Boon) - #41: ConsecutiveBlankLines rule (formatting) - Makes sure there are no consecutive lines that are either blank or whitespace only. (Thanks to Joe Sondow) - #42: BlankLineBeforePackage rule (formatting) - Makes sure there are no blank lines before the package declaration of a source code file. (Thanks to Joe Sondow) - #43: FileEndsWithoutNewline rule (formatting) - Makes sure the source code file ends with a newline character. (Thanks to Joe Sondow) - #44: MissingBlankLineAfterImports rule (formatting) - Makes sure there is a blank line after the imports of a source code file. (Thanks to Joe Sondow) - #46: MissingBlankLineAfterPackage rule (formatting) - Makes sure there is a blank line after the package statement of a source code file. (Thanks to Joe Sondow) - #47: TrailingWhitespaceRule (formatting) - Checks that no lines of source code end with whitespace characters. (Thanks to Joe Sondow) - #411: ExceptionExtendsThrowable rule (exceptions) - Checks for classes that extend Throwable. Custom exception classes should subclass Exception or one of its descendants. - #341: UnnecessaryCast rule (unnecessary) - Checks for unnecessary cast operations. - #149: IllegalSubclass rule (generic) - Checks for classes that extend one of the specified set of illegal superclasses. - #157: UnnecessaryToString rule (unnecessary) - Checks for unnecessary calls to toString(). - #152: JUnitPublicProperty rule (junit) - Checks for public properties defined on JUnit test classes. - #422: ToStringReturnsNull rule (design) - Checks for toString() methods that return null. - #143: MultipleUnaryOperators rule (basic) - Checks for multiple consecutive unary operators. UPDATED/ENHANCED RULES AND BUG FIXES - #31: UnusedImportRule: Extended to now also detect cases where the imported class name occurs as a substring in the source code. (Thanks to Ren? Scheibe) - #36: UnnecessaryDefInMethodDeclaration: Prevent false positives from modifiers within quoted method name. (Thanks to Ren? Scheibe) - #37: LineLengthRule: Flags to ignore import and package statements line length. (Thanks to Kyle Boon) - #35: UnnecessaryPackageReferenceRule: raises confusing violation for Script with package. - #48: Fix Method chaining breaks SpaceAfterComma. - #49: Fix SpaceBeforeOpeningBrace doesn't work on switch statements. - #50: Fix UnnecessaryDotClass doesn't work if class is qualified - #153: Fix ClosureStatementOnOpeningLineOfMultipleLineClosure does not catch multiline closure with only a single statement. Changes in version 0.20 (Dec 2013) ------------------------------------------- NEW RULES - #425: LocaleSetDefault rule (design) - Checks for calls to Locale.setDefault(), which sets the Locale across the entire JVM. (Thanks to Ming Huang and Rob Patrick) - #114: IllegalString rule (generic) - Checks for a specified illegal string within the source code. - #430: SpaceAroundMapEntryColon rule (formatting) - Check for proper formatting of whitespace around ':' for literal Map entries. - #427: ClosureStatementOnOpeningLineOfMultipleLineClosure rule (formatting) - Checks for closure logic on first line (after ->) for a multi-line closure. UPDATED/ENHANCED RULES - #426: Disable GrailsPublicControllerMethod by default. - #424: Expand SpaceAroundOperator rule to also check for "as" operator. - #432: Add checkLastStatementImplicitElse property on IfStatementCouldBeTernary and UnnecessaryIfStatement. BUG FIXES - #409: Fix bug ClassNameSameAsFilenameRule when sourceCode.name is null. - #22: Fix DuplicateStringLiteral: Allow empty strings within ignoreStrings. (Thanks to Ei Kageyama) - #21: Fix ClassJavadoc rule has no effect. Also ignore blank lines between javadoc and class declaration. - #143: Fix UnsafeImplementationAsMap - duplicate violation. - #135: Fix CoupledTestCase incorrectly thrown when referencing the current class. - #24: Enable Groovy ruleset to find custom rules (pass the current ClassLoader to the GroovyShell). (Thanks John Engelman) - #26: Fix MissingMethodException error on custom rule with recent Groovy. (Thanks to Joe Sondow) - #146: Fix SpaceAroundOperator: Does not catch some violations with elvis operator (?:) - #139: Fix JUnitPublicField to ignore interfaces. FRAMEWORK AND INFRASTRUCTURE - #23: Inline violations support within rule tests. (Thanks to Artur Gajowy) - #428: Use ClassNode if present in ImportNode to get line number and possibly source text - #431: Remove unused "samples" folder. - #434: Remove duplicate logging of CodeNarc results. - #433: Rename BaseSourceAnalyzer to AbstractSourceAnalyzer. Changes in version 0.19 (Jul 2013) ------------------------------------------- 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/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. Changes in version 0.18.1 (Feb 2013) ------------------------------------------- BUG FIXES - Fix #3596256: SpaceAroundOperatorRule: False positive if source line contains unicode chars. Also affects (known limitation): SpaceAfterClosingBrace, SpaceBeforeOpeningBrace, SpaceBeforeClosingBrace - Known limitation: will not catch violations on same line following unicode char literal. - Fix #3598154: SpaceAroundOperator: bad/duplicate violation for ?: after closure. Ignore standalone elvis expression statements (known limitation). - Fix #3598717: BracesForClassRule failing on annotation types. (Known limitation: ignore for @interface). Thanks to Marcin Gryszko. - Fix #3598732: BracesForMethodRule fixed for methods with closure parameters. Thanks to Marcin Gryszko. - Fix #3596323: BracesForClassRule ignored for enums and Groovy 1.7. Thanks to Marcin Gryszko. - Fix for CodeNarc GitHub issue #10: No such property: maxMethodComplexity for class: org.codenarc.rule.size.AbcMetricRule. - Fix #3604095: AssignCollectionSort ignore calls that pass in mutate=false; add checks for two-arg calls. - Fix #3603257: UnusedVariable reported for variable used in (more than one) for loop. Changes in version 0.18 (Dec 2012 ) ------------------------------------------- NEW RULES - #3531554: New JUnitLostTest rule. Checks for classes that import JUnit 4 classes and contain a public, instance, void, no-arg method named test* that is not annotated with @Test. - #3509530: New SpaceAfterComma rule. Checks that there is at least one space or whitespace following each comma. That includes checks for method and closure declaration parameter lists, method call parameter lists, Map literals and List literals. - #3583257: New SpaceAfterSemicolon rule. Checks that there is at least one space or whitespace following a semicolon that separates classic for loop clauses and also multiple statements per line. - #3509532: New SpaceAroundOperator rule. Check that there is at least one space (blank) or whitespace around each binary operator, including: +, -, *, /, >>, <<, &&, ||, &, |, ?:, =. - #3583262: New SpaceBeforeOpeningBrace rule. Check that there is at least one space (blank) or whitespace before each opening brace ("{"). This checks method/class/interface declarations, closure expressions and block statements. - #3583262: New SpaceAfterOpeningBrace rule. Check that there is at least one space (blank) or whitespace after each opening brace ("{"). This checks method/class/interface declarations, closure expressions and block statements. - #3583262: New SpaceAfterClosingBrace rule. Check that there is at least one space (blank) or whitespace after each closing brace ("}"). This checks method/class/interface declarations, closure expressions and block statements. - #3583262: New SpaceBeforeClosingBrace rule. Check that there is at least one space (blank) or whitespace before each closing brace ("}"). This checks method/class/interface declarations, closure expressions and block statements. - #3589701: New SpaceAfterIf rule. Check that there is exactly one space (blank) after the if keyword and before the opening parenthesis. - #3589701: New SpaceAfterWhile rule. Check that there is exactly one space (blank) after the while keyword and before the opening parenthesis. - #3589701: New SpaceAfterFor rule. Check that there is exactly one space (blank) after the for keyword and before the opening parenthesis. - #3589701: New SpaceAfterSwitch rule. Check that there is exactly one space (blank) after the switch keyword and before the opening parenthesis. - #3589701: New SpaceAfterCatch rule. Check that there is exactly one space (blank) after the catch keyword and before the opening parenthesis. - #3581377: New JUnitUnnecessaryThrowsException rule. Check for throws clauses on JUnit test methods. That is not necessary in Groovy. - #3575859: New GrailsDuplicateMapping rule. Check for duplicate entry in a domain class mapping. - #3575861: New GrailsDuplicateConstraint rule. Check for duplicate constraints entry - #3592678: New IfStatementCouldBeTernary rule - Checks for if statements where both the if and else blocks contain only a single return statement with a value - #3581378: New ExceptionNotThrown rule - Checks for an exception constructor call without a throw as the last statement within a catch block. UPDATED/ENHANCED RULES - Pull request #2: Adding support for catch, finally, and else brace placement validation. Thanks to Matias Bjarland. - #3521130: PrintStackTrace: Also check for StackTraceUtils.printSanitizedStackTrace(). - #3589971: Add threshold for max class metric value for CyclomaticComplexity, AbcMetric and CrapMetric. - #3574257: Rename AbcComplexity rule to AbcMetric. Deprecate old AbcComplexity rule and set enabled=false. Rename properties, e.g. maxMethodAbcScore. - Pull request #5: Enhanced UnusedVariableRule to enable ignoring some variables (ignoreVariableNames). Thanks to René Scheibe. BUG FIXES - Fix #3555096: UnusedPrivateMethod - StringIndexOutOfBoundsException for zero-length method name. - Fix #3524882: False positive UnnecessaryPackageReference violation for Enums. - Fix #3558623: UnnecessarySemicolon - violations inside classes were ignored. Thanks to Marcin Erdmann. - Fix #3574259: CyclomaticComplexity, CrapMetric and AbcComplexity: Do not check class-level metric value if maxClassAverageMethodXX value is null or 0. - Fix #3526749: The FieldName rule should ignore serialVersionUID fields by default. - Fix #3543848: Online docs; formatting on Naming rules doc. - Fix #3441842: Online docs; UnnecessarySubstring documentation is misleading. - Fix #3511004: PrivateFieldCouldBeFinal false positive (-- and ++ operators). - Fix Pull request #4: parseReport doesn't work with absolute paths on windows. Thanks to Gavin Matthews. FRAMEWORK AND INFRASTRUCTURE - #3546737: Migrate source code from Subversion to GitHub. Many thanks to Marcin Erdmann. - #3578372: Add notes to rule index and sample rule sets that ABC/CC rules require the GMetrics jar. - #3578909: Move helper methods from AbstractTestCase into new TestUtil class (to enable use by other test frameworks, e.g. Spock) - #3578909: Upgrade tests and test framework to JUnit 4. - #3578909: Move test framework classes into src/main/groovy, so that they are included in the CodeNarc jar: AbstractTestCase, InMemoryAppender, TestUtil, AbstractRuleTestCase, StubRule - Switch to Sonatype OSS Maven Repository Changes in version 0.17 (March 2012) ------------------------------------------- NEW RULES - #3433042: New PrivateFieldCouldBeFinal rule: Checks for private fields that are only set within a constructor or field initializer. Such fields can safely be made final. - #3432991: New ParameterReassignment rule: Checks for a method or closure parameter being reassigned to a new value within the body of the method/closure, which is a confusing, bad practice. Use a temporary variable instead. - #3108331: New TernaryCouldBeElvis rule: Checks for ternary with boolean and true expressions are the same; can be simplified to an Elvis expression. - #3489801: New AssertWithinFinallyBlock rule: Checks for assert statements within a finally block. An assert can throw an exception, hiding the original exception, if there is one. - #3489800: New ConstantAssertExpression rule: Checks for assert statements where the assert condition expressions is a constant value or literal value. - #3161693: New BrokenNullCheck rule: Looks for faulty checks for null that can cause a NullPointerException. - #3495466: New VectorIsObsolete rule: Checks for references to the (effectively) obsolete java.util.Vector class. Use the Java Collections Framework classes instead including ArrayList or Collections.synchronizedList(). - #3495466: New HashtableIsObsolete rule: Checks for references to the (effectively) obsolete java.util.Hashtable class. Use the Java Collections Framework classes instead including HashMap or ConcurrentHashMap. - #3485545: New CrapMetric rule: Checks the CRAP metric score for methods. This metric is based on the cyclomatic complexity and test coverage for individual methods. Requires a Cobertura XML coverage file and GMetrics 0.5. UPDATED/ENHANCED RULES - #3476844: Extend GetterMethodCouldBeProperty to also check static getter methods. - #3477351: UnnecessaryConstructor: Also catch constructor containing only call to super(). - #3460463: StatelessClassRule and GrailsStatelessServiceRule: Ignore fields annotated with @Inject. - #3460463: GrailsStatelessServiceRule: Ignore non-static properties (i.e., no visibility modifier specified) declared with "def". - #3485544: AssignmentInConditional: Also catch nested binary expressions, e.g. if (x==1 || x=3) - #3488705: GrailsDomainHasToString: Ignore classes annotated with @ToString or @Canonical. - #3488704: GrailsDomainHasEquals: Ignore classes annotated with @EqualsAndHashCode or @Canonical. - #3501349: UnnecessaryPackageReference: Also check for explicitly-imported classes. - #3509542: UnnecessaryPackageReference: Also check for package references in "as <Class>". BUG FIXES - #3463408: Remove dependency on Java 1.6 (String.isEmpty()). - #3475170: Fix duplicate violations for SimpleDateFormatMissingLocale. - #3477085. Fix UnusedImport violations missing line numbers for imports with semicolons. - #3477162: Fix duplicate violations for UnnecessaryDotClass. - #3487448: Fix UnnecessaryNullCheckBeforeInstanceOf should also check standalone binary (boolean) expressions, e.g. boolean ready = x != null && x instanceof Integer - #3496557: Fix UseCollectNestedRule: GroovyCastException: Cannot cast object VariableExpression to class ClosureExpression - #3496696: Fix UnusedPrivateFieldRule: GroovyCastException: Cannot cast object with class 'org.codehaus.groovy.ast.FieldNode' to class 'groovy.lang.MetaClass'. FRAMEWORK AND INFRASTRUCTURE - #3495841: Support Groovy 2.x. - #3496463: Support GMetrics 0.5. - #3476394: Include PMD report in project reports; Fix/resolve violations. - Introduce AbstractSharedAstVisitorRule. Refactor UnusedPrivateFieldRule and UnusedPrivateMethodRule to use it. - Add exists() method to org.codenarc.util.io.Resource and implementations
Source: README.txt, updated 2014-04-23

Thanks for helping keep SourceForge clean.

Screenshot instructions:
Red Hat Linux   Ubuntu

Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Briefly describe the problem (required):

Upload screenshot of ad (required):
Select a file, or drag & drop file here.

Please provide the ad click URL, if possible:

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks