Package | Total Files | Files with Violations | Priority 1 | Priority 2 | Priority 3 |
---|---|---|---|---|---|
All Packages | 419 | 58 | - | 78 | 36 |
<Root> | 9 | 3 | - | - | 12 |
basic | 45 | - | - | - | - |
braces | 4 | - | - | - | - |
comments | 19 | 13 | - | - | 15 |
concurrency | 27 | - | - | - | - |
convention | 29 | 1 | - | - | 1 |
design | 26 | 3 | - | 1 | 2 |
dry | 4 | - | - | - | - |
enhanced | 1 | 1 | - | - | 1 |
exceptions | 20 | - | - | - | - |
formatting | 38 | 15 | - | 26 | 3 |
generic | 11 | 2 | - | 3 | - |
grails | 12 | 2 | - | 3 | - |
groovyism | 33 | 3 | - | 18 | - |
imports | 7 | 1 | - | 1 | - |
jdbc | 6 | - | - | - | - |
junit | 26 | - | - | - | - |
logging | 8 | - | - | - | - |
naming | 16 | 1 | - | 1 | - |
security | 10 | - | - | - | - |
serialization | 4 | - | - | - | - |
size | 9 | 2 | - | - | 2 |
unnecessary | 46 | 6 | - | 14 | - |
unused | 9 | 5 | - | 11 | - |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryObjectReferences | 3 | 185 | [SRC]rule.doNotApplyToClassNames = 'Xxx' // doNotApply = NO [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 188 | [SRC]rule.applyToClassNames = 'Xxx' // apply = NO [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 189 | [SRC]rule.doNotApplyToClassNames = 'Xxx' // doNotApply = NO [MSG]The code could be more concise by using a with() or identity() block |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryObjectReferences | 3 | 137 | [SRC]rule.doNotApplyToFilesMatching = NO_MATCH // doNotApply = NO [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 140 | [SRC]rule.applyToFilesMatching = NO_MATCH // apply = NO [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 141 | [SRC]rule.doNotApplyToFilesMatching = NO_MATCH // doNotApply = NO [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 177 | [SRC]rule.applyToFileNames = 'org/codenarc/MyOtherTest.groovy' [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 225 | [SRC]rule.doNotApplyToFileNames = 'Xxx.groovy' // doNotApply = NO [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 228 | [SRC]rule.applyToFileNames = 'Xxx.groovy' // apply = NO [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 229 | [SRC]rule.doNotApplyToFileNames = 'Xxx.groovy' // doNotApply = NO [MSG]The code could be more concise by using a with() or identity() block |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MisorderedStaticImports | 3 | 20 | [SRC]import static org.codenarc.rule.InlineViolationsParser.inlineViolation [MSG]Static imports should appear before normal imports |
UnnecessaryReturnKeyword | 3 | 199 | [SRC]return [lineNumber: lineNumber, sourceLineText: sourceLi..messageText] [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 53 | [SRC]return rule.name [MSG]The return keyword is not needed and can be removed |
UnnecessaryReturnKeyword | 3 | 56 | [SRC]return "The javadoc ${getTag()} tag is empty" [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 51 | [SRC]return rule.name [MSG]The return keyword is not needed and can be removed |
UnnecessaryReturnKeyword | 3 | 54 | [SRC]return "The description for the javadoc ${getTag()} tag is missing" [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@author' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@exception' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@param' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@return' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@see' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@since' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@throws' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@version' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@exception' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@param' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 27 | [SRC]return '@throws' [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 34 | [SRC]return new CompileStaticRule() [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 106 | [SRC]return inlineViolation('Nested for loop') [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 128 | [SRC]return "The method $methodName in class MyClass returns .. collection" [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 26 | [SRC]class PrivateFieldCouldBeFinalRuleTest extends AbstractR..FinalRule> { [MSG]Class org.codenarc.rule.design.PrivateFieldCouldBeFinalRuleTest has 34 methods |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 261 | [SRC]return "Method '$methodName' is overriding a method in '.. @Override." [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 101 | [SRC]final SOURCE = ''' [MSG]The String ' for(String name=${SomeClass.SOME_CONSTANT}; name==null;) // And what about {} { doStuff() } ' contains a GString-type expression: '${SomeClass.SOME_CONSTANT}; name==null;) // And what about {}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 59 | [SRC]final SOURCE = ''' [MSG]The String ' if (someContainer."${SomeClass.SOME_CONSTANT}" != null) // And what about {} { doStuff() } ' contains a GString-type expression: '${SomeClass.SOME_CONSTANT}" != null) // And what about {}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 28 | [SRC]class BracesForMethodRuleTest extends AbstractRuleTestCa..ethodRule> { [MSG]Class org.codenarc.rule.formatting.BracesForMethodRuleTest has 38 methods |
GStringExpressionWithinString | 2 | 356 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { int size(String name = "${SomeClass.SOME_CONSTANT}") { return 99 } } ' contains a GString-type expression: '${SomeClass.SOME_CONSTANT}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 181 | [SRC]return rule [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 27 | [SRC]class ClassEndsWithBlankLineRuleTest extends AbstractRul..kLineRule> { [MSG]Class org.codenarc.rule.formatting.ClassEndsWithBlankLineRuleTest has 33 methods |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 28 | [SRC]class ClassStartsWithBlankLineRuleTest extends AbstractR..kLineRule> { [MSG]Class org.codenarc.rule.formatting.ClassStartsWithBlankLineRuleTest has 50 methods |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 26 | [SRC]class IndentationRuleTest extends AbstractRuleTestCase<I..ationRule> { [MSG]Class org.codenarc.rule.formatting.IndentationRuleTest has 58 methods |
GStringExpressionWithinString | 2 | 609 | [SRC]final SOURCE = ''' [MSG]The String ' |class MyClass { | private void execute() { | try { | executeWithArgs(args) | } | catch(Throwable t) { | println "ERROR: ${t.message}" | t.printStackTrace() // wrong column | } | finally { | closeResources() | } | } | private void executeOtherOne() { | try { | println 999 // wrong column | executeWithArgs(args) | } catch(Throwable t) { | t.printStackTrace() | } finally { | closeResources() | notifyUser() // wrong column | } | } |} ' contains a GString-type expression: '${t.message}' |
GStringExpressionWithinString | 2 | 1018 | [SRC]final SOURCE = ''' [MSG]The String ' |project.files(project.configurations.scaconfig.files.findAll { File it -> it.name.endsWith '.aar' }.collect { File it -> | MessageDigest sha1 = MessageDigest.getInstance('SHA1') | String inputFile = 'COMMAND=PREPARE_LIBRARY\n' + | "FILE_PATH=${it.absolutePath}\n" | String hash = new BigInteger(1, sha1.digest(inputFile.bytes)).toString(16) | cacheDir + hash + File.separator + 'output/jars/classes.jar' |}).asFileTree ' contains a GString-type expression: '${it.absolutePath}' |
GStringExpressionWithinString | 2 | 1032 | [SRC]final SOURCE = ''' [MSG]The String ' |"${if (true) 'content' else ''}" ' contains a GString-type expression: '${if (true) 'content' else ''}' |
GStringExpressionWithinString | 2 | 1040 | [SRC]final SOURCE = ''' [MSG]The String ' |package com.sample | |trait RegressionTest { | | String callStackPath = "src/test/resources/callstacks/" | | /** | * Checks the current callstack is the same as the reference callstack. | * The reference callstack can be updated into a txt file in the callStackPath | * | * Pattern: <RegressionTest.callStackPath>/<ClassTestSimpleName><_subname>.txt | * @param subname optional subname, used in the reference callstack filename | */ | void testNonRegression(String subname = '') { | String targetFileName = "${callStackPath}${this.class.simpleName}" | if (subname) { | targetFileName += "_${subname}" | } | RegressionTestHelper.testNonRegression(helper, targetFileName) | } |} ' contains a GString-type expression: '${callStackPath}${this.class.simpleName}' |
ClassSize | 3 | 26 | [MSG]Class "IndentationRuleTest" is 1191 lines |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 82 | [SRC]final SOURCE = ''' [MSG]The String ' |buildFileList() | .collect { File it -> | MessageDigest sha1 = MessageDigest.getInstance('SHA1') | String inputFile = 'COMMAND=PREPARE_LIBRARY\n' + | "FILE_PATH=${it.absolutePath}\n" | cacheDir + File.separator + inputFile + sha1 | } | .each { name -> | println name | } |println "done" | |list2.collect { item -> | item.name |}.each { name -> println name } | |otherList.collect { item -> item.name }.each { name -> println name } | |if (expr instanceof ConstructorCallExpression || expr instanceof CastExpression) { | [Map, Iterable, List, Collection, ArrayList, Set, HashSet].findAll { | AstUtil.classNodeImplementsType(expr.type, it) | }.each { | callbackFunction() | } |} ' contains a GString-type expression: '${it.absolutePath}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 98 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { private @Autowired DataSource dataSource private @Value('${name}') String name } ' contains a GString-type expression: '${name}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 38 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { def myMethod() { def closure = { } if (true) { } while(ready) { } try { } catch(Exception e) { } finally { } for(int i=0; i<10; i++) { } for(String name in names) { } for(String name: names) { } if (count > this."maxPriority${priority}Violations") { } while (count > this."maxPriority${priority}Violations") { } } MyClass() { this(classNames) } // ok static void reset() { violationCounts = [1:0, 2:0, 3:0] } void doStuff() { println 9 } } interface MyInterface { } enum MyEnum { OK, BAD } ' contains a GString-type expression: '${priority}Violations") { }' |
GStringExpressionWithinString | 2 | 304 | [SRC]assertNoViolations(''' [MSG]The String ' def foo = 1 "I am a ${ -> foo }" ' contains a GString-type expression: '${ -> foo }' |
GStringExpressionWithinString | 2 | 312 | [SRC]assertNoViolations(''' [MSG]The String ' def foo = 1 "I am a ${ -> foo }0" ' contains a GString-type expression: '${ -> foo }' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 53 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { def template() { return { td(getResourceBundleString('htmlReport.summary.allPackages'), class:'allPackages') td { a(pathName, href:"#${pathName}") } } } } ' contains a GString-type expression: '${pathName}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 40 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { def myMethod() { def closure = { } if (true) { } while(ready) { } try { } catch(Exception e) { } finally { } for(int i=0; i<10; i++) { } for(String name in names) { } for(String name: names) { } if (count > this."maxPriority${priority}Violations") { } while (count > this."maxPriority${priority}Violations") { } } MyClass() { this(classNames) } MyClass(String s) { } MyClass(@Annotation('${prop}') String s) { } MyClass(Date date) { // comment this(classNames) } MyClass(Object object) { /* comment */ } } interface MyInterface { } enum MyEnum { OK, BAD } trait MyTrait { } ' contains a GString-type expression: '${priority}Violations") { }' |
GStringExpressionWithinString | 2 | 102 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { def myMethod() { def closure = {} if (true) {} while(ready) {} try { } catch(Exception e) { } finally {} for(int i=0; i<10; i++) {} for(String name in names) {} for(String name: names) {} if (count > this."maxPriority${priority}Violations") {} while (count > this."maxPriority${priority}Violations") {} } void doStuff2() {} MyClass() {} MyClass(@Annotation('${prop}') String s) {} } interface MyInterface2 {} ' contains a GString-type expression: '${priority}Violations") {}' |
GStringExpressionWithinString | 2 | 196 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { MyClass() {int count } MyClass() {s = '{"json": true}' } MyClass(@Annotation('${prop}') String s) {println 123 } } ' contains a GString-type expression: '${prop}') String s) {println 123 }' |
GStringExpressionWithinString | 2 | 207 | [SRC][line:5, source:'MyClass(@Annotation(\'${prop}\') String..s MyClass']) [MSG]The String 'MyClass(@Annotation('${prop}') String s) {println 123 }' contains a GString-type expression: '${prop}') String s) {println 123 }' |
GStringExpressionWithinString | 2 | 325 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { String s MyClass() { s = '{"json": true}' } MyClass(@Annotation('${prop}') String s) { println 123 } } ' contains a GString-type expression: '${prop}') String s) { println 123 }' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 167 | [SRC]return inlineViolation("The colon for the literal Map en..className" + [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 39 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { def myMethod() { def closure = { } if (true) { } while(ready) { } try { } catch(Exception e) { } finally { } for(int i=0; i<10; i++) { } for(String name in names) { } for(String name: names) { } if (count > this."maxPriority${priority}Violations") { } while (count > this."maxPriority${priority}Violations") { } } MyClass() { this(classNames) } static void reset() { violationCounts = [1:0, 2:0, 3:0] } void doStuff() { println 9 } } interface MyInterface { } enum MyEnum { OK, BAD } ' contains a GString-type expression: '${priority}Violations") { }' |
GStringExpressionWithinString | 2 | 80 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { def myMethod() { def closure = {} if (true) {} while(ready) {} try { } catch(Exception e) { } finally {} for(int i=0; i<10; i++) {} for(String name in names) {} for(String name: names) {} if (count > this."maxPriority${priority}Violations") {} while (count > this."maxPriority${priority}Violations") {} } void doStuff2() {} } interface MyInterface2 {} ' contains a GString-type expression: '${priority}Violations") {}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 38 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { def myMethod() { def closure = { } if (true) { } while(ready) { } try { } catch(Exception e) { } finally { } for(int i=0; i<10; i++) { } for(String name in names) { } for(String name: names) { } if (count > this."maxPriority${priority}Violations") { } while (count > this."maxPriority${priority}Violations") { } } MyClass() { this(classNames) } } interface MyInterface { } enum MyEnum { OK, BAD } trait MyTrait { } ' contains a GString-type expression: '${priority}Violations") { }' |
GStringExpressionWithinString | 2 | 277 | [SRC]assertNoViolations(''' [MSG]The String ' def foo = 1 "I am a ${ -> foo }" ' contains a GString-type expression: '${ -> foo }' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 64 | [SRC]final SOURCE = ''' [MSG]The String ' if (value.class == org.bad.BadClass) { } println "isClosure=${value instanceof org.bad.OtherClass}" def count = org.bad.Helper.getCount() ' contains a GString-type expression: '${value instanceof org.bad.OtherClass}' |
GStringExpressionWithinString | 2 | 72 | [SRC][line:3, source:'println "isClosure=${value instanceof o..:'org.bad'], [MSG]The String 'println "isClosure=${value instanceof org.bad.OtherClass}"' contains a GString-type expression: '${value instanceof org.bad.OtherClass}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 84 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { @Value('${org.codenarc.test}') BigDecimal depositAmount } ' contains a GString-type expression: '${org.codenarc.test}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 36 | [SRC]final SOURCE = ''' [MSG]The String ' class Person { String name Boolean isAdmin } def bindingMap = [name: 'John', isAdmin: true] def person = new Person() def p2 = new Person("It is currently ${ new Date() }") def p3 = new Person(bindingMap) person.name = bindingMap['name'] person.isAdmin = bindingMap.isAdmin person.properties = "It is currently ${ new Date() }" ' contains a GString-type expression: '${ new Date() }' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 78 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { def mySession = servletContext def edit = { println "amount=${servletContext.amount}" } } ' contains a GString-type expression: '${servletContext.amount}' |
GStringExpressionWithinString | 2 | 87 | [SRC]assertTwoViolations(SOURCE, 3, 'def mySession = servletC..t.amount}"') [MSG]The String 'println "amount=${servletContext.amount}"' contains a GString-type expression: '${servletContext.amount}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 242 | [SRC]final SOURCE = ''' [MSG]The String ' new Exception("${it.orElseThrow { new AssertionError() }}") ' contains a GString-type expression: '${it.orElseThrow { new AssertionError() }}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 44 | [SRC]final SOURCE = ''' [MSG]The String ' Map map = ["${ someRef }" : 'invalid' ] ' contains a GString-type expression: '${ someRef }' |
GStringExpressionWithinString | 2 | 48 | [SRC]2, '["${ someRef }" :') [MSG]The String '["${ someRef }" :' contains a GString-type expression: '${ someRef }' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 49 | [SRC]final SOURCE = ''' [MSG]The String ' class SomeClass { @SomeAnnotationOnField('${sample.property1}') String sampleProperty @SomeAnnotationOnMethod('${sample.property2}') void method() { } } ' contains a GString-type expression: '${sample.property1}' |
GStringExpressionWithinString | 2 | 64 | [SRC]final SOURCE = ''' [MSG]The String ' @SomeAnnotationOnClass('${sample.property1}') class SomeClass { @SomeAnnotationOnField('${sample.property2}') String sampleProperty @SomeAnnotationOnMethod('${sample.property3}') void method() { } } ' contains a GString-type expression: '${sample.property1}' |
GStringExpressionWithinString | 2 | 80 | [SRC]final SOURCE = ''' [MSG]The String ' @SomeAnnotationOnClass(attribute='${sample.property1}', nested=[@NestedAnnotation('${sample.property2}'), @NestedAnnotation('${sample.property3}')], someOtherAttribute='${sample.property4}') class SomeClass { } ' contains a GString-type expression: '${sample.property1}' |
GStringExpressionWithinString | 2 | 93 | [SRC]final SOURCE = ''' [MSG]The String ' @SomeAnnotationOnClass(attribute=['${sample.property1}', '${sample.property2}']) class SomeClass { } ' contains a GString-type expression: '${sample.property1}', '${sample.property2}' |
GStringExpressionWithinString | 2 | 103 | [SRC]final SOURCE = ''' [MSG]The String ' def valueToBeReplaced = '123' def str1 = "123" def str2 = "abc def ghi" def str3 = "abc ${count}" def str4 = "abc $count }" def str5 = "abc {123}" def str6 = "abc ${}" def str7 = "total: ${count * 25}" def str8 = "$valueToBeReplaced $valueNotToBeReplaced" ' contains a GString-type expression: '${count}' |
GStringExpressionWithinString | 2 | 119 | [SRC]final SOURCE = ''' [MSG]The String ' def "plugin does not apply idea plugin"() { given: buildScript << """ task $testTaskName { doLast { println "Has idea plugin: \${project.plugins.hasPlugin(IdeaPlugin)}" } } """ expect: runTask(testTaskName).output.contains('Has idea plugin: false') where: testTaskName = 'hasIdeaPlugin' } ' contains a GString-type expression: '${project.plugins.hasPlugin(IdeaPlugin)}' |
GStringExpressionWithinString | 2 | 142 | [SRC]final SOURCE = ''' [MSG]The String ' def str1 = 'total: ${count}' def str2 = 'average: ${total / count}' ' contains a GString-type expression: '${count}' |
GStringExpressionWithinString | 2 | 147 | [SRC][line:2, source:"def str1 = 'total: \${count}'", message..{count}\''], [MSG]The String 'def str1 = 'total: ${count}'' contains a GString-type expression: '${count}' |
GStringExpressionWithinString | 2 | 147 | [SRC][line:2, source:"def str1 = 'total: \${count}'", message..{count}\''], [MSG]The String ''${count}'' contains a GString-type expression: '${count}' |
GStringExpressionWithinString | 2 | 148 | [SRC][line:3, source:"def str2 = 'average: \${total / count}'.. count}\'']) [MSG]The String 'def str2 = 'average: ${total / count}'' contains a GString-type expression: '${total / count}' |
GStringExpressionWithinString | 2 | 148 | [SRC][line:3, source:"def str2 = 'average: \${total / count}'.. count}\'']) [MSG]The String ''${total / count}'' contains a GString-type expression: '${total / count}' |
GStringExpressionWithinString | 2 | 153 | [SRC]final SOURCE = ''' [MSG]The String ' class SomeClass { @SomeAnnotationOnMethod('${sample.property}') void method() { def str1 = 'total: ${count}' } } ' contains a GString-type expression: '${sample.property}' |
GStringExpressionWithinString | 2 | 161 | [SRC]assertSingleViolation(SOURCE, 5, "def str1 = 'total: \${..${count}\'') [MSG]The String 'def str1 = 'total: ${count}'' contains a GString-type expression: '${count}' |
GStringExpressionWithinString | 2 | 161 | [SRC]assertSingleViolation(SOURCE, 5, "def str1 = 'total: \${..${count}\'') [MSG]The String ''${count}'' contains a GString-type expression: '${count}' |
GStringExpressionWithinString | 2 | 166 | [SRC]final SOURCE = ''' [MSG]The String ' class SomeClass { @SomeAnnotationOnField(someClass = SomeOtherClass, message = 'Some message ${sample.property1}') String sampleProperty } ' contains a GString-type expression: '${sample.property1}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 215 | [SRC]final SOURCE = ''' [MSG]The String ' import test.TestData1 import test.TestData2 import test.TestData3 import test.TestData4 import test.TestData5 import test.TestData6 import test.TestData7 import test.TestData8 import test.TestData9 import test.TestData10 import test.TestData11 import test.TestData12 import test.TestData13 import test.TestData14 import test.TestData15 def GSTRING1 = " ${TestData1.GOOD_XML}" def GSTRING2 = " $TestData2.XML" def MAP1 = [(TestData3):123] def MAP2 = [abc:TestData4] def MAP3 = [abc:TestData5, ddd:123] def LIST = [TestData6,TestData7] def OPERATORS1 = 0+TestData8.VALUE-TestData9.VALUE def OPERATORS2 = 9*TestData10.VALUE/TestData11.VALUE def OPERATORS3 = 64&TestData12.VALUE|TestData13.VALUE^TestData14.VALUE def OPERATORS4 = !TestData15.VALUE ' contains a GString-type expression: '${TestData1.GOOD_XML}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 28 | [SRC]class FieldNameRuleTest extends AbstractRuleTestCase<FieldNameRule> { [MSG]Class org.codenarc.rule.naming.FieldNameRuleTest has 32 methods |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MisorderedStaticImports | 3 | 22 | [SRC]import static org.codenarc.test.TestUtil.shouldFailWithM..geContaining [MSG]Static imports should appear before normal imports |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryReturnKeyword | 3 | 252 | [SRC]return inlineViolation("Number of parameters in ${name} ..ameters}).") [MSG]The return keyword is not needed and can be removed |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 65 | [SRC]final SOURCE = ''' [MSG]The String ' def b = "$Hello" + 'World' // should be "${Hello}World" ' contains a GString-type expression: '${Hello}' |
GStringExpressionWithinString | 2 | 73 | [SRC]final SOURCE = ''' [MSG]The String ' def c = 'Hello' + "$World" // should be "Hello${World}" ' contains a GString-type expression: '${World}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 36 | [SRC]final SOURCE = ''' [MSG]The String ' def docFile = "docs/codenarc-rules-${ruleSetName}.apt" ' contains a GString-type expression: '${ruleSetName}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 180 | [SRC]final SOURCE = ''' [MSG]The String ' Mock { getSomeData() } Stub(1,2,3) { getData2() } "${'Stub'}"(MyClass) { getData3() } def closure = { getData4() } Mock({ getData5() }, 1234) // 2nd param is not a Closure Spy { getMoreData() } ' contains a GString-type expression: '${'Stub'}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 66 | [SRC]final SOURCE = ''' [MSG]The String ' if (value.class == java.math.BigDecimal) { } println "isClosure=${value instanceof groovy.lang.Closure}" def processors = java.lang.Runtime.availableProcessors() ' contains a GString-type expression: '${value instanceof groovy.lang.Closure}' |
GStringExpressionWithinString | 2 | 73 | [SRC][line:3, source:'println "isClosure=${value instanceof g..oovy.lang'], [MSG]The String 'println "isClosure=${value instanceof groovy.lang.Closure}"' contains a GString-type expression: '${value instanceof groovy.lang.Closure}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 97 | [SRC]final SOURCE = ''' [MSG]The String ' if (!file.setExecutable(true)) { throw new Exception("Cannot set ${file} as executable") } def count = x.setCount(92) ' contains a GString-type expression: '${file}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 67 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { def name = "Joe" + new Date().toString() void run() { Object object = 1 def string = 'some string' + object.toString() def withinGString = "processing: ${'prefix' + object.toString()}" def bigString = 'some string' + new Date() + object.toString() // not a violation; known limitation def other = 123 + object.toString().toInteger() // not a violation } } ' contains a GString-type expression: '${'prefix' + object.toString()}' |
GStringExpressionWithinString | 2 | 84 | [SRC][line:8, source:'def withinGString = "processing: ${\'pr..necessary']) [MSG]The String 'def withinGString = "processing: ${'prefix' + object.toString()}"' contains a GString-type expression: '${'prefix' + object.toString()}' |
GStringExpressionWithinString | 2 | 89 | [SRC]final SOURCE = ''' [MSG]The String ' def string = "some string${123L.toString()} or ${123} or ${'ABC'} or ${new Date().toString()}" def string2 = """ processing: ${123L.toString()} processing: ${new Date().toString()} """ ' contains a GString-type expression: '${123L.toString()} or ${123} or ${'ABC'} or ${new Date().toString()}' |
GStringExpressionWithinString | 2 | 97 | [SRC][line:2, source:'def string = "some string${123L.toStrin..necessary'], [MSG]The String 'def string = "some string${123L.toString()} or ${123} or ${'ABC'} or ${new Date().toString()}"' contains a GString-type expression: '${123L.toString()} or ${123} or ${'ABC'} or ${new Date().toString()}' |
GStringExpressionWithinString | 2 | 98 | [SRC][line:2, source:'def string = "some string${123L.toStrin..necessary'], [MSG]The String 'def string = "some string${123L.toString()} or ${123} or ${'ABC'} or ${new Date().toString()}"' contains a GString-type expression: '${123L.toString()} or ${123} or ${'ABC'} or ${new Date().toString()}' |
GStringExpressionWithinString | 2 | 99 | [SRC][line:4, source:'processing: ${123L.toString()}', messag..necessary'], [MSG]The String 'processing: ${123L.toString()}' contains a GString-type expression: '${123L.toString()}' |
GStringExpressionWithinString | 2 | 100 | [SRC][line:5, source:'processing: ${new Date().toString()}', ..nnecessary'] [MSG]The String 'processing: ${new Date().toString()}' contains a GString-type expression: '${new Date().toString()}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 27 | [SRC]abstract class AbstractUnusedPrivateFieldRuleTest extend..FieldRule> { [MSG]Class org.codenarc.rule.unused.AbstractUnusedPrivateFieldRuleTest has 32 methods |
GStringExpressionWithinString | 2 | 172 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { private int count def other = this."${'count'}" } ' contains a GString-type expression: '${'count'}' |
GStringExpressionWithinString | 2 | 183 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { private int count def varName = "count" def other = this."${varName}" // can't see this } ' contains a GString-type expression: '${varName}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 150 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { MyClass() { } MyClass(String id) { println id } String myMethod1(String id, int value) { doSomething(value); return id } void myMethod2(int value) { def x = value } def myMethod3(Date startDate) { return "${startDate}" } def myMethod4(Date startDate) { return new Object() { def x = startDate } } def myMethod5(Date startDate) { return new Object() { String toString() { return startDate } } } } ' contains a GString-type expression: '${startDate}" }' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 126 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { private String myMethod1(String id, int value) { doSomething(value); return id } private void myMethod2(int value) { def x = value } private def myMethod3(Date startDate) { return "${startDate}" } private def myMethod4(Date startDate) { return new Object() { def x = startDate } } private def myMethod5(Date startDate) { return new Object() { String toString() { return startDate } } } } ' contains a GString-type expression: '${startDate}" }' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 26 | [SRC]class UnusedPrivateMethodRuleTest extends AbstractRuleTe..ethodRule> { [MSG]Class org.codenarc.rule.unused.UnusedPrivateMethodRuleTest has 37 methods |
GStringExpressionWithinString | 2 | 354 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { private int countStuff() { return 99 } int somePublicMethod() { } def abc = 'abc' private String getName() { 'abc' } private getPrice() { 0.0 } def doStuff() { def count = countStuff() def newName = this.getName() } def myClosure = { println "price is ${getPrice()}" } } ' contains a GString-type expression: '${getPrice()}" }' |
GStringExpressionWithinString | 2 | 423 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { static int getTotal() { println "total=${MyClass.countStuff()}" } private static int countStuff() { } } ' contains a GString-type expression: '${MyClass.countStuff()}' |
GStringExpressionWithinString | 2 | 436 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { private int countStuff() { } def other = this."${countStuff}"() } ' contains a GString-type expression: '${countStuff}' |
GStringExpressionWithinString | 2 | 458 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { private int countStuff() { } def varName = "countStuff" def other = this."${varName}"() // can't see this } ' contains a GString-type expression: '${varName}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 26 | [SRC]class UnusedVariableRuleTest extends AbstractRuleTestCas..iableRule> { [MSG]Class org.codenarc.rule.unused.UnusedVariableRuleTest has 35 methods |