Package | Total Files | Files with Violations | Priority 1 | Priority 2 | Priority 3 |
---|---|---|---|---|---|
All Packages | 400 | 51 | - | 65 | 34 |
<Root> | 10 | 4 | - | - | 14 |
basic | 44 | - | - | - | - |
braces | 4 | - | - | - | - |
comments | 17 | 13 | - | - | 15 |
concurrency | 26 | - | - | - | - |
convention | 25 | 1 | - | - | 1 |
design | 23 | 2 | - | 1 | 1 |
dry | 4 | - | - | - | - |
enhanced | 1 | - | - | - | - |
exceptions | 20 | - | - | - | - |
formatting | 32 | 11 | - | 22 | 1 |
generic | 11 | 1 | - | 2 | - |
grails | 11 | 2 | - | 3 | - |
groovyism | 33 | 3 | - | 17 | - |
imports | 7 | 1 | - | 1 | - |
jdbc | 6 | - | - | - | - |
junit | 25 | - | - | - | - |
logging | 8 | - | - | - | - |
naming | 16 | 1 | - | 1 | - |
security | 10 | - | - | - | - |
serialization | 4 | - | - | - | - |
size | 9 | 2 | - | - | 2 |
unnecessary | 47 | 5 | - | 7 | - |
unused | 7 | 5 | - | 11 | - |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
UnnecessaryObjectReferences | 3 | 184 | [SRC]rule.doNotApplyToClassNames = 'Xxx' // doNotApply = NO [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 187 | [SRC]rule.applyToClassNames = 'Xxx' // apply = NO [MSG]The code could be more concise by using a with() or identity() block |
UnnecessaryObjectReferences | 3 | 188 | [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 |
---|---|---|---|
MisorderedStaticImports | 3 | 22 | [SRC]import static org.codenarc.rule.AbstractEnhanceableAstVi..TEM_PROPERTY [MSG]Static imports should appear before normal imports |
MisorderedStaticImports | 3 | 23 | [SRC]import static org.codenarc.source.SourceCode.DEFAULT_COMPILER_PHASE [MSG]Static imports should appear before normal imports |
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 |
---|---|---|---|
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 |
---|---|---|---|
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 |
---|---|---|---|
GStringExpressionWithinString | 2 | 285 | [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 |
---|---|---|---|
MethodCount | 2 | 27 | [SRC]class ClassEndsWithBlankLineRuleTest extends AbstractRul..kLineRule> { [MSG]Class org.codenarc.rule.formatting.ClassEndsWithBlankLineRuleTest has 32 methods |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
MethodCount | 2 | 27 | [SRC]class ClassStartsWithBlankLineRuleTest extends AbstractR..kLineRule> { [MSG]Class org.codenarc.rule.formatting.ClassStartsWithBlankLineRuleTest has 32 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 45 methods |
GStringExpressionWithinString | 2 | 551 | [SRC]final SOURCE = ''' [MSG]The String ' |class MyClass { | private void execute() { | try { | executeWithArgs(args) | } | catch(Throwable t) { | println "ERROR: ${t.message}" | t.printStackTrace() | } | finally { | closeResources() | } | } | private void executeOtherOne() { | try { | executeWithArgs(args) | } catch(Throwable t) { | t.printStackTrace() | } finally { | closeResources() | } | } |} ' contains a GString-type expression: '${t.message}' |
GStringExpressionWithinString | 2 | 841 | [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 | 855 | [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}' |
GStringExpressionWithinString | 2 | 887 | [SRC]final SOURCE = ''' [MSG]The String ' |"${if (true) 'content' else ''}" ' contains a GString-type expression: '${if (true) 'content' else ''}' |
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) } 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 | 291 | [SRC]assertNoViolations(''' [MSG]The String ' def foo = 1 "I am a ${ -> foo }" ' contains a GString-type expression: '${ -> foo }' |
GStringExpressionWithinString | 2 | 299 | [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 | 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) } MyClass(String s) { } MyClass(@Annotation('${prop}') String s) { } } interface MyInterface { } enum MyEnum { OK, BAD } trait MyTrait { } ' contains a GString-type expression: '${priority}Violations") { }' |
GStringExpressionWithinString | 2 | 81 | [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 | 175 | [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 | 186 | [SRC][lineNumber:5, sourceLineText:'MyClass(@Annotation(\'${p..s MyClass']) [MSG]The String 'MyClass(@Annotation('${prop}') String s) {println 123 }' contains a GString-type expression: '${prop}') String s) {println 123 }' |
GStringExpressionWithinString | 2 | 304 | [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 | 115 | [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 | 262 | [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][lineNumber:3, sourceLineText:'println "isClosure=${valu..:'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 | 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 | 244 | [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][lineNumber:2, sourceLineText:"def str1 = 'total: \${cou..{count}\''], [MSG]The String 'def str1 = 'total: ${count}'' contains a GString-type expression: '${count}' |
GStringExpressionWithinString | 2 | 147 | [SRC][lineNumber:2, sourceLineText:"def str1 = 'total: \${cou..{count}\''], [MSG]The String ''${count}'' contains a GString-type expression: '${count}' |
GStringExpressionWithinString | 2 | 148 | [SRC][lineNumber:3, sourceLineText:"def str2 = 'average: \${t.. count}\'']) [MSG]The String 'def str2 = 'average: ${total / count}'' contains a GString-type expression: '${total / count}' |
GStringExpressionWithinString | 2 | 148 | [SRC][lineNumber:3, sourceLineText:"def str2 = 'average: \${t.. 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}' |
Rule Name | Priority | Line # | Source Line / Message |
---|---|---|---|
GStringExpressionWithinString | 2 | 192 | [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 = "src/site/apt/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 | 67 | [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 | 74 | [SRC][lineNumber:3, sourceLineText:'println "isClosure=${valu..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 | 69 | [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 | 135 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { 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 |
---|---|---|---|
MethodCount | 2 | 27 | [SRC]class UnusedPrivateFieldRuleTest extends AbstractRuleTes..FieldRule> { [MSG]Class org.codenarc.rule.unused.UnusedPrivateFieldRuleTest has 32 methods |
GStringExpressionWithinString | 2 | 166 | [SRC]final SOURCE = ''' [MSG]The String ' class MyClass { private int count def other = this."${'count'}" } ' contains a GString-type expression: '${'count'}' |
GStringExpressionWithinString | 2 | 177 | [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 | 111 | [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 36 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 |