Skip to content

Commit

Permalink
Prepare for CodeNarc version 3.4.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismair committed Jan 13, 2024
1 parent 06e5c32 commit 1e6956f
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 30 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Expand Up @@ -3,25 +3,25 @@

NOTE: CodeNarc now provides a separate **3.x.x-groovy-4.x** version for use with Groovy 4.x.

TODO: Version 3.4.0 (??? 202?)
Version 3.4.0 (Jan 2024)
--------------------------------------
Updated/Enhanced Rules and Bug Fixes
- #751: **ClassStartsWithBlankLine** rule: Fix for interfaces, enums and traits with annotations on the same line. ([Sven](https://github.com/s-ven))
- #739: **NoScriptBindings** rule: Fix false positive when local variable is reassigned.
- #745: **TrailingComma** rule: Do not require trailing comma if last item is followed by closing bracket on the same line for Maps (that is consistent with Lists).
- #743: **SpaceAfterCommentDelimiter** and **SpaceBeforeCommentDelimiter** rules: Fix false negatives for dollar-slashy strings.
- #748: **UnnecessarySetter** rule: Skip calls to static methods in the same class.
- #749: **UnnecessaryGString** rule: Escape special chars in the violation message so it reflects the actual source.
- #749: **UnnecessaryGString** rule: Escape special chars in the violation message to reflect the actual source.
- #758: **SpaceAroundOperator** rule: Fix violation for the optional array operator `?[`.

Command-line
- #754: Command-line (FilesystemSourceAnalyzer): Match includes and excludes against full source file path and also against path relative to the base directory.
- #756: Command-line (FilesystemSourceAnalyzer): Fix relative paths on Windows. ([Steven Hartland](https://github.com/stevenh))

Documentation and Miscellaneous
- #744: Fix wording and typos. ([René Scheibe](https://github.com/darxriggs))
- #740: Naming Rules: Fix asterisks not showing up when rendering Markdown.
- #759: Consolidate analysis results and violations for report writer tests. [Dec 31]
Miscellaneous
- #744: Documentation: Fix wording and typos. ([René Scheibe](https://github.com/darxriggs))
- #740: Documentation: In, "Naming Rules", fix asterisks not showing up when rendering Markdown.
- #759: Consolidate analysis results and violations for report writer tests.


Version 3.3.0 (Jul 2023)
Expand Down
2 changes: 1 addition & 1 deletion build-groovy4.gradle
Expand Up @@ -14,7 +14,7 @@ shadowJar {

group = 'org.codenarc'
archivesBaseName = 'CodeNarc'
version = '3.3.0-groovy-4.0'
version = '3.4.0-groovy-4.0'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -14,7 +14,7 @@ shadowJar {

group = 'org.codenarc'
archivesBaseName = 'CodeNarc'
version = '3.3.0'
version = '3.4.0'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
Expand Down
6 changes: 3 additions & 3 deletions docs/SampleCodeNarcHtmlReport.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/SampleCodeNarcJsonReport.json
@@ -1,10 +1,10 @@
{
"codeNarc": {
"url": "https://codenarc.org",
"version": "3.3.0"
"version": "3.4.0"
},
"report": {
"timestamp": "Jul 29, 2023 5:26:27 PM"
"timestamp": "Jan 13, 2024 11:01:24 AM"
},
"project": {
"title": "Sample Project",
Expand Down Expand Up @@ -1534,7 +1534,7 @@
"priority": 2,
"lineNumber": 28,
"sourceLine": "class ClassStartsWithBlankLineRuleTest extends AbstractRuleTestCase<ClassStartsWithBlankLineRule> {",
"message": "Class org.codenarc.rule.formatting.ClassStartsWithBlankLineRuleTest has 47 methods"
"message": "Class org.codenarc.rule.formatting.ClassStartsWithBlankLineRuleTest has 50 methods"
}
]
},
Expand Down Expand Up @@ -3297,7 +3297,7 @@
{
"ruleName": "GStringExpressionWithinString",
"priority": 2,
"lineNumber": 80,
"lineNumber": 97,
"sourceLine": "final SOURCE = '''",
"message": "The String '\n if (!file.setExecutable(true)) {\n throw new Exception(\"Cannot set ${file} as executable\")\n }\n def count = x.setCount(92)\n ' contains a GString-type expression: '${file}'"
}
Expand Down
6 changes: 3 additions & 3 deletions docs/SampleCodeNarcSortableHtmlReport.html
Expand Up @@ -255,7 +255,7 @@
}
}
}
}</script></head><body><img class='logo' src='http://codenarc.github.io/CodeNarc/images/codenarc-logo.png' alt='CodeNarc' align='right'/><h1>CodeNarc Report</h1><div class='metadata'><table><tr><td class='em'>Report title:</td><td>Sample Project</td></tr><tr><td class='em'>Date:</td><td>Jul 29, 2023 5:26:26 PM</td></tr><tr><td class='em'>Generated with:</td><td><a href='https://codenarc.org'>CodeNarc v3.3.0</a></td></tr></table></div><div class='summary'><h2>Summary</h2><table><thead><tr class='tableHeader'><th>Total Files</th><th>Files with Violations</th><th>Priority 1</th><th>Priority 2</th><th>Priority 3</th></tr></thead><tbody><tr><td class='number'>419</td><td class='number'>58</td><td class='priority1'>-</td><td class='priority2'>78</td><td class='priority3'>36</td></tr></tbody></table></div><h2>Violations</h2><div class='buttons'><button type='button' onclick='sortData(sortByRuleName)'>Sort by Rule Name</button><button type='button' onclick='sortData(sortByPriority)'>Sort by Rule Priority</button><button type='button' onclick='sortData(sortByRule)'>Sort by Rule (w/Most Violations)</button><button type='button' onclick='sortData(sortByFile)'>Sort by File (w/Most Violations)</button></div><table id='violationsTable' border='1'><thead><tr class='tableHeader'><th>File</th><th>Rule Name</th><th>Priority</th><th>Line #</th><th>Source Line / Message</th></tr></thead><tbody><tr><td class='pathColumn'>design/PrivateFieldCouldBeFinalRuleTest.groovy</td><td class='ruleColumn'><a href='#MethodCount'>MethodCount</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>26</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>class PrivateFieldCouldBeFinalRuleTest extends AbstractR..FinalRule&gt; {</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Class org.codenarc.rule.design.PrivateFieldCouldBeFinalRuleTest has 34 methods</span></p></td></tr><tr><td class='pathColumn'>formatting/BracesForForLoopRuleTest.groovy</td><td class='ruleColumn'><a href='#GStringExpressionWithinString'>GStringExpressionWithinString</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>101</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>final SOURCE = '''</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>The String '
}</script></head><body><img class='logo' src='http://codenarc.github.io/CodeNarc/images/codenarc-logo.png' alt='CodeNarc' align='right'/><h1>CodeNarc Report</h1><div class='metadata'><table><tr><td class='em'>Report title:</td><td>Sample Project</td></tr><tr><td class='em'>Date:</td><td>Jan 13, 2024 11:01:23 AM</td></tr><tr><td class='em'>Generated with:</td><td><a href='https://codenarc.org'>CodeNarc v3.4.0</a></td></tr></table></div><div class='summary'><h2>Summary</h2><table><thead><tr class='tableHeader'><th>Total Files</th><th>Files with Violations</th><th>Priority 1</th><th>Priority 2</th><th>Priority 3</th></tr></thead><tbody><tr><td class='number'>419</td><td class='number'>58</td><td class='priority1'>-</td><td class='priority2'>78</td><td class='priority3'>36</td></tr></tbody></table></div><h2>Violations</h2><div class='buttons'><button type='button' onclick='sortData(sortByRuleName)'>Sort by Rule Name</button><button type='button' onclick='sortData(sortByPriority)'>Sort by Rule Priority</button><button type='button' onclick='sortData(sortByRule)'>Sort by Rule (w/Most Violations)</button><button type='button' onclick='sortData(sortByFile)'>Sort by File (w/Most Violations)</button></div><table id='violationsTable' border='1'><thead><tr class='tableHeader'><th>File</th><th>Rule Name</th><th>Priority</th><th>Line #</th><th>Source Line / Message</th></tr></thead><tbody><tr><td class='pathColumn'>design/PrivateFieldCouldBeFinalRuleTest.groovy</td><td class='ruleColumn'><a href='#MethodCount'>MethodCount</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>26</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>class PrivateFieldCouldBeFinalRuleTest extends AbstractR..FinalRule&gt; {</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Class org.codenarc.rule.design.PrivateFieldCouldBeFinalRuleTest has 34 methods</span></p></td></tr><tr><td class='pathColumn'>formatting/BracesForForLoopRuleTest.groovy</td><td class='ruleColumn'><a href='#GStringExpressionWithinString'>GStringExpressionWithinString</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>101</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>final SOURCE = '''</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>The String '
for(String name=${SomeClass.SOME_CONSTANT}; name==null;) // And what about {}
{
doStuff()
Expand All @@ -272,7 +272,7 @@
return 99
}
}
' contains a GString-type expression: '${SomeClass.SOME_CONSTANT}'</span></p></td></tr><tr><td class='pathColumn'>formatting/ClassEndsWithBlankLineRuleTest.groovy</td><td class='ruleColumn'><a href='#MethodCount'>MethodCount</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>27</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>class ClassEndsWithBlankLineRuleTest extends AbstractRul..kLineRule&gt; {</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Class org.codenarc.rule.formatting.ClassEndsWithBlankLineRuleTest has 33 methods</span></p></td></tr><tr><td class='pathColumn'>formatting/ClassStartsWithBlankLineRuleTest.groovy</td><td class='ruleColumn'><a href='#MethodCount'>MethodCount</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>28</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>class ClassStartsWithBlankLineRuleTest extends AbstractR..kLineRule&gt; {</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Class org.codenarc.rule.formatting.ClassStartsWithBlankLineRuleTest has 47 methods</span></p></td></tr><tr><td class='pathColumn'>formatting/IndentationRuleTest.groovy</td><td class='ruleColumn'><a href='#MethodCount'>MethodCount</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>26</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>class IndentationRuleTest extends AbstractRuleTestCase&lt;I..ationRule&gt; {</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Class org.codenarc.rule.formatting.IndentationRuleTest has 58 methods</span></p></td></tr><tr><td class='pathColumn'>formatting/IndentationRuleTest.groovy</td><td class='ruleColumn'><a href='#GStringExpressionWithinString'>GStringExpressionWithinString</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>609</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>final SOURCE = '''</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>The String '
' contains a GString-type expression: '${SomeClass.SOME_CONSTANT}'</span></p></td></tr><tr><td class='pathColumn'>formatting/ClassEndsWithBlankLineRuleTest.groovy</td><td class='ruleColumn'><a href='#MethodCount'>MethodCount</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>27</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>class ClassEndsWithBlankLineRuleTest extends AbstractRul..kLineRule&gt; {</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Class org.codenarc.rule.formatting.ClassEndsWithBlankLineRuleTest has 33 methods</span></p></td></tr><tr><td class='pathColumn'>formatting/ClassStartsWithBlankLineRuleTest.groovy</td><td class='ruleColumn'><a href='#MethodCount'>MethodCount</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>28</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>class ClassStartsWithBlankLineRuleTest extends AbstractR..kLineRule&gt; {</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Class org.codenarc.rule.formatting.ClassStartsWithBlankLineRuleTest has 50 methods</span></p></td></tr><tr><td class='pathColumn'>formatting/IndentationRuleTest.groovy</td><td class='ruleColumn'><a href='#MethodCount'>MethodCount</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>26</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>class IndentationRuleTest extends AbstractRuleTestCase&lt;I..ationRule&gt; {</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>Class org.codenarc.rule.formatting.IndentationRuleTest has 58 methods</span></p></td></tr><tr><td class='pathColumn'>formatting/IndentationRuleTest.groovy</td><td class='ruleColumn'><a href='#GStringExpressionWithinString'>GStringExpressionWithinString</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>609</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>final SOURCE = '''</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>The String '
|class MyClass {
| private void execute() {
| try {
Expand Down Expand Up @@ -686,7 +686,7 @@
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}'</span></p></td></tr><tr><td class='pathColumn'>unnecessary/UnnecessaryPackageReferenceRuleTest.groovy</td><td class='ruleColumn'><a href='#GStringExpressionWithinString'>GStringExpressionWithinString</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>73</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>[line:3, source:'println "isClosure=${value instanceof g..oovy.lang'],</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>The String 'println "isClosure=${value instanceof groovy.lang.Closure}"' contains a GString-type expression: '${value instanceof groovy.lang.Closure}'</span></p></td></tr><tr><td class='pathColumn'>unnecessary/UnnecessarySetterRuleTest.groovy</td><td class='ruleColumn'><a href='#GStringExpressionWithinString'>GStringExpressionWithinString</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>80</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>final SOURCE = '''</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>The String '
' contains a GString-type expression: '${value instanceof groovy.lang.Closure}'</span></p></td></tr><tr><td class='pathColumn'>unnecessary/UnnecessaryPackageReferenceRuleTest.groovy</td><td class='ruleColumn'><a href='#GStringExpressionWithinString'>GStringExpressionWithinString</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>73</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>[line:3, source:'println "isClosure=${value instanceof g..oovy.lang'],</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>The String 'println "isClosure=${value instanceof groovy.lang.Closure}"' contains a GString-type expression: '${value instanceof groovy.lang.Closure}'</span></p></td></tr><tr><td class='pathColumn'>unnecessary/UnnecessarySetterRuleTest.groovy</td><td class='ruleColumn'><a href='#GStringExpressionWithinString'>GStringExpressionWithinString</a></td><td class='priority2 priorityColumn'>2</td><td class='number'>97</td><td><p class='violationInfo'><span class='violationInfoPrefix'>[SRC]</span><span class='sourceCode'>final SOURCE = '''</span></p><p class='violationInfo'><span class='violationInfoPrefix'>[MSG]</span><span class='violationMessage'>The String '
if (!file.setExecutable(true)) {
throw new Exception("Cannot set ${file} as executable")
}
Expand Down
8 changes: 4 additions & 4 deletions docs/SampleCodeNarcTextReport.txt
@@ -1,4 +1,4 @@
CodeNarc Report: Sample Project - Jul 29, 2023 5:26:28 PM
CodeNarc Report: Sample Project - Jan 13, 2024 11:01:25 AM

Summary: TotalFiles=419 FilesWithViolations=58 P1=0 P2=78 P3=36

Expand Down Expand Up @@ -110,7 +110,7 @@ File: formatting/ClassEndsWithBlankLineRuleTest.groovy
Violation: Rule=MethodCount P=2 Line=27 Msg=[Class org.codenarc.rule.formatting.ClassEndsWithBlankLineRuleTest has 33 methods] Src=[class ClassEndsWithBlankLineRuleTest extends AbstractRuleTestCase<ClassEndsWithBlankLineRule> {]

File: formatting/ClassStartsWithBlankLineRuleTest.groovy
Violation: Rule=MethodCount P=2 Line=28 Msg=[Class org.codenarc.rule.formatting.ClassStartsWithBlankLineRuleTest has 47 methods] Src=[class ClassStartsWithBlankLineRuleTest extends AbstractRuleTestCase<ClassStartsWithBlankLineRule> {]
Violation: Rule=MethodCount P=2 Line=28 Msg=[Class org.codenarc.rule.formatting.ClassStartsWithBlankLineRuleTest has 50 methods] Src=[class ClassStartsWithBlankLineRuleTest extends AbstractRuleTestCase<ClassStartsWithBlankLineRule> {]

File: formatting/IndentationRuleTest.groovy
Violation: Rule=MethodCount P=2 Line=26 Msg=[Class org.codenarc.rule.formatting.IndentationRuleTest has 58 methods] Src=[class IndentationRuleTest extends AbstractRuleTestCase<IndentationRule> {]
Expand Down Expand Up @@ -631,7 +631,7 @@ File: unnecessary/UnnecessaryPackageReferenceRuleTest.groovy
Violation: Rule=GStringExpressionWithinString P=2 Line=73 Msg=[The String 'println "isClosure=${value instanceof groovy.lang.Closure}"' contains a GString-type expression: '${value instanceof groovy.lang.Closure}'] Src=[[line:3, source:'println "isClosure=${value instanceof groovy.lang.Closure}"', message:'groovy.lang'],]

File: unnecessary/UnnecessarySetterRuleTest.groovy
Violation: Rule=GStringExpressionWithinString P=2 Line=80 Msg=[The String '
Violation: Rule=GStringExpressionWithinString P=2 Line=97 Msg=[The String '
if (!file.setExecutable(true)) {
throw new Exception("Cannot set ${file} as executable")
}
Expand Down Expand Up @@ -766,4 +766,4 @@ File: unused/UnusedPrivateMethodRuleTest.groovy
File: unused/UnusedVariableRuleTest.groovy
Violation: Rule=MethodCount P=2 Line=26 Msg=[Class org.codenarc.rule.unused.UnusedVariableRuleTest has 35 methods] Src=[class UnusedVariableRuleTest extends AbstractRuleTestCase<UnusedVariableRule> {]

[CodeNarc (https://codenarc.org) v3.3.0]
[CodeNarc (https://codenarc.org) v3.4.0]

0 comments on commit 1e6956f

Please sign in to comment.