Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update codenarcVersion to v3 (major) #120

Merged
merged 4 commits into from
Dec 4, 2023

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 29, 2023

Mend Renovate logo banner

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
codenarc (source) 1.6.1 -> 3.3.0 age adoption passing confidence
org.codenarc:CodeNarc (source) 1.6.1 -> 3.3.0 age adoption passing confidence

Release Notes

CodeNarc/CodeNarc (codenarc)

v3.3.0

New Rules

  • #​728: New SpockMissingAssert rule (junit) - Checks for boolean conditions intended as assertions within Spock tests that are nested within a block and are thus ignored. (Jean André Gauthier)
  • #​730: New SpaceAfterCommentDelimiter rule (comments) - Checks that there is whitespace after comment characters (// and /*).
  • #​737: New SpaceBeforeCommentDelimiter rule (comments) - Checks that there is whitespace before comment characters (// and /*).
  • #​738: New NoScriptBindings rule (concurrency) - Checks for global variables that are bound to a script; they can cause concurrency bugs. (Josh Chorlton)

Updated/Enhanced Rules and Bug Fixes

  • #​729: Indentation rule: Add optional indentUnderLabel property to allow indenting code underneath labels. (Charalampos Makrylakis)
  • #​725: ImplicitReturnStatement rule: Fix false positive for return within a synchronized block.
  • #​733: SpaceAfterOpeningBrace rule: Fix false positive for Groovy 4 switch expressions.
  • #​726: Fixed CodeNarc command-line -sourcefiles argument to use the basedir parameter (if specified), and work with paths relative to the current directory. Changed FilesSourceAnalyzer to default baseDirectory to ‘.’ rather than System.getProperty('user.dir').

Documentation

  • codenarc-other-tools-frameworks: Added link to #​630 for info on controlling the version of Groovy that CodeNarc uses for the Gradle plugin.

v3.2.0

Updated/Enhanced Rules and Bug Fixes

  • #​701: EmptyTryBlock rule: Ignore all try-with-resources statements (since having an empty try block with those is a valid scenario).
  • #​715: SpaceBeforeOpeningBrace and SpaceAfterOpeningBrace rules: Fix false positive when non-printable ASCII chars on the same line.
  • #​716: Indentation rule: Fix false positive for nested blocks in closures.
  • #​722: CouldBeSwitchStatement rule: Prevent violation if other statements are between if statements.

Build, Infrastructure and Tests

  • Create GitHub Action "gradle.yml" to build+test on push or PR.
  • #​724: Use Groovy 4.0.7 to build Groovy 4 CodeNarc jar.
  • #​708: Include internal results for files without violations, to enable accurate baseline reporting. (Ulrich Eckhardt)
  • #​717: Allow to send list of files in argument sourcefiles (Nicolas Vuillamy)

Documentation

  • #​719: Remove CodeNarc Eclipse plugin reference. (René Scheibe)
  • #​720: ConsecutiveBlankLines: Document known limitation: False positive violation for consecutive blank lines within string literals.
  • #​674: README and Command-Line page: Add info on building CodeNarc jar locally from running using that jar. Add links for CodeNarc, Groovy and Logback jars.

v3.1.0

Updated/Enhanced Rules and Bug Fixes

  • #​688: SpaceAfterMethodCallName rule: Fix false positives. NOTE: No longer check method calls without parentheses.
  • #​703: UnnecessaryPublicModifier rule: Fix PatternSyntaxException if method name contains special (regex) characters.
  • #​702: Indentation rule: Fix false positive for try-with-resources. Also skip generated code and single-line blocks.
  • #​692: UnusedPrivateField: Ignore classes annotated with @​Entity. Add ignoreClassesAnnotatedWithNames property.

Build, Infrastructure and Tests

  • #​709: Publish Groovy 4.x-specific jar for CodeNarc. Upgrade to GMetrics 2.1.0.
  • #​705: Make SourceFileTest more multi-platform friendly. (Paul King)
  • #​711: Change Groovy 4 artifact from CodeNarc-Groovy4 to CodeNarc; change version to 3.1.0-groovy-4.0. [Aug 2022]

v3.0.1

Updated/Enhanced Rules and Bug Fixes

  • #​683: UnnecessaryPublicModifier: Fix StringIndexOutOfBoundsException.
  • #​686: SpaceAfterMethodCallName: Fix handling methods with special characters.
  • #​687: SpaceAfterMethodCallName: Fix handling methods with special chars. (René Scheibe)
  • #​699: UnusedImportRule: Detect property-style usage of static imports. (Leonard Brünings)

Build, Infrastructure and Tests

v3.0.0

Updated/Enhanced Rules and Bug Fixes

  • #​651: MissingOverrideAnnotation: Ignore private superclass methods.
  • #​652: ClassStartsWithBlankLine: Fix NPE on annotated class with no following line at end of source file.
  • #​653: UseCollectNested: Fix false positive when inner collect() call returns a different type.
  • #​650: UnnecessaryPublicModifier: Fix false positive with annotations.
  • #​657: SpaceAfterMethodCallName: Fix wrong line number for multi-line method calls.
  • #​661: GStringExpressionWithinString: Fix MissingMethodException for some annotations. (Damir Murat)
  • #​663: MissingBlankLineBeforeAnnotatedField: Fix false positive for annotation followed by inline comment. (Damir Murat)
  • #​667: TrailingComma: Fix StringIndexOutOfBoundsException.
  • #​670: JUnitPublicNonTestMethod, JUnitTestMethodWithoutAssert: Also treat JUnit 5.x @​org.junit.jupiter.api.Test as a test method.
  • #​670: JUnitAssertEqualsConstantActualValue: Support JUnit 5 Assertions.assertEquals().
  • #​671: StaticMethodsBeforeInstanceMethods: Ignore generated instance methods.
  • #​672: EmptyTryBlock: Also support try-with-resources.
  • #​675: ExceptionExtendsError: Exclude interfaces and classes that implement an "Error" interface.
  • #​675: ExceptionExtendsThrowable: Exclude interfaces and classes that implement a "Throwable" interface.
  • #​676: BracesForTryCatchFinally: Fix false positive from try-with-resources.
  • #​677: UnnecessarySetter: Fix false positive when the setter return value is used in a nested expression.
  • #​656: Remove deprecated UnnecessarySubstring rule.
  • #​664: Remove hacks and workarounds required for Groovy 1.x and 2.x.

Build and Infrastructure

  • [BREAKING CHANGE] Requires Java 8 and Groovy 3.x.
  • #​654: Upgrade to Groovy 3.0.9. Groovy 2.x will no longer be supported.
  • #​665: Upgrade to GMetrics 2.0.0.
  • #​665: Upgrade to SLF4J 1.7.35.
  • #​666: Upgrade to JUnit 5.8. Upgrade test framework and all tests to use JUnit 5.
  • #​673: Add support for the excludeBaseline parameter for the CodeNarc command-line. (Ulrich Eckhardt)
  • #​668: Add support for the failOnError parameter for the CodeNarc command-line.
  • #​649: Support for description inside CodeNarc enable/disable comments. (davidkron)
  • #​664: AstUtil: Simplify findFirstNonAnnotationLine() last annotation logic and check for “class” within the line if it is a ClassNode. Simplify getAnnotation().

v2.2.0

Updated/Enhanced Rules and Bug Fixes

  • #​607: AssignCollectionSort: Fix the violation message. (Vladimir Orany)
  • #​635: BracesForMethod: Allow braces on the next line for multi-line declarations. New allowBraceOnNextLineForMultilineDeclarations rule property. (Damir Murat)
  • #​638: ClassStartsWithBlankLine: Fix false positive if interface/class declaration takes more than 1 line.
  • #​629: ClosureAsLastMethodParameter: Add ignoreCallsToMethodNames property.
  • #​631: ClosureAsLastMethodParameter: Fix false positive when using Groovy 3 Lambda syntax.
  • #​623: ExplicitCallToDivMethod: Ignore dev() method calls if argument is a Map, Closure or String.
  • #​646: IllegalStringRule: Return actual line number containing (first) matching string in violation.
  • #​626: Indentation: Fix ArrayIndexOutOfBoundsException: -2 for generated method calls.
  • #​624: JUnitPublicNonTestMethod: Fix false positive for @​ParameterizedTest.
  • #​606: MissingBlankLineBeforeAnnotatedField: Ignore fields that start on the first line of the class.
  • #​633: MissingBlankLineBeforeAnnotatedField false positive at the top of an annotated class. (Damir Murat)
  • #​644: NoTabCharacter: Return actual line number containing (first) tab character in violation.
  • #​618: ReturnsNullInsteadOfEmptyCollection: Fix false positive in nested closure.
  • #​639: SerializableClassMustDefineSerialVersionUID: Ignore interfaces.
  • #​634: SpaceAfterClosingBrace and SpaceBeforeClosingBrace: Fix false positives with annotated methods. (Damir Murat)
  • #​608: SpaceAfterMethodCallName: Fix ArrayIndexOutOfBoundsException.
  • #​627: SpaceAfterMethodCallName: Skip method calls with a single Lambda argument.
  • #​645: SpaceAfterMethodCallName: Fix false positive if method parameters include parentheses.
  • #​609: SpaceInsideParentheses: Fix false-positive inside slashy strings (regular expressions).
  • #​613: SpaceInsideParentheses: Fix false positive for parentheses within multi-line comments.
  • #​620: UnusedImportRule: Ignore generated imports. Fix #​619. (Søren Berg Glasius)

Build and Infrastructure

Documentation

v2.1.0

New Rules

  • #​580: New SpaceAfterNotOperator rule (formatting) - Checks if whitespace does directly follow usages of not operator. (Marcin Erdmann)
  • #​586: New SpaceAfterMethodCallName rule (formatting) - Checks that there is no whitespace after the method name when a method call contains parenthesis or that there is at most one space after the method name if the call does not contain parenthesis. (Marcin Erdmann)
  • #​584: New SpaceAfterMethodDeclarationName rule (formatting) - Checks whether method declarations do not contain unnecessary whitespace between method name and the opening parenthesis for parameter list. (Marcin Erdmann)
  • #​582: New MissingBlankLineBeforeAnnotatedField rule (formatting) - Checks that there is a blank line before a field declaration that uses annotations. (Marcin Erdmann)
  • #​592: New SpaceInsideParentheses rule (formatting) - Check for whitespace after opening parentheses and before closing parentheses.
  • #​604: New ParameterAssignmentInFilterClosure rule (basic) - An assignment operator was used on a parameter in a filtering closure. This is usually a typo, and the comparison operator (==) was intended.

Updated/Enhanced Rules and Bug Fixes

  • #​567: SpaceAfterComma rule: Do not assume that expression's column number will always be set. (Marcin Erdmann)
  • #​571: Support Groovy 3.0.6 and fix test failures.
  • #​576: EmptyMethod rule: Ignore pointcuts for empty methods. (Thomas Lefèvre)
  • #​562: Deprecate the UnnecessarySubstring rule. Its recommendation to use subscripts on strings is not always safe/valid.
  • #​578: UnusedPrivateField rule: Add ability to raise violations for fields which are only used within constructors. (Marcin Erdmann)
  • #​561: VariableName rule: Ignore variables with the @Field annotation.
  • #​590: ClassStartsWithBlankLine: Fix NullPointerException on single-line class at very end of file (no newline).
  • #​599: SpaceAfterComma: Fix false positive if source line contains Emoji (non-ASCII chars) on Groovy 3.
  • #​603: BracesForMethod: Fix false positive on Groovy 3.0.7 for multi-line method declarations.
  • #​577: UnusedMethodParameter: Ignore methods annotated with @​Pointcut.

Build and Infrastructure

  • #​574: CodeNarc command-line: Support -properties command-line argument to specify name/location for "codenarc.properties" file.
  • #​570: Publish a fat jar. (Eric Citaire)
  • #​573: Add Dockerfile to build CodeNarc Docker image using Gradle and Shadowjar.
  • #​589: Upgrade to Groovy 2.5.14 (minor patch release), to address CVE-2020-17521. Note: CodeNarc does not use any of the vulnerable Groovy components.
  • #​593: Command-line: Catch exception during rule processing, log error message with rule/filename and keep going.
  • #​601: Publish Javadocs. https://javadoc.io/doc/org.codenarc/CodeNarc
  • #​569: Adding the Compact Text Report Writer. (Luís Zimmermann)
  • #​598: JSON RuleSet: Fixed NPE, added some logging for an invalid rule name.
  • #​605: AbstractRuleTestCase: Provide aliases for assertViolations Map keys: lineNumber = line, sourceLineText = source, messageText = message.

Documentation

  • #​594: Fix a typo in online docs for Instanceof, changing "*Exceptions" to "*Exception". (qxo)

v2.0.0

New Rules

  • #​548: New OptionalField rule (design) - Do not use an Optional as a field type.
  • #​549: New OptionalMethodParameter rule (design) - Do not use an Optional as a parameter type for a method or constructor.
  • #​550: New OptionalCollectionReturnType rule (design) - Do not declare a method return type of Optional<List> (or Collection, ArrayList, Set, Map, HashMap, etc.). Return an empty collection instead.

Updated/Enhanced Rules and Bug Fixes

  • #​467: VariableName rule: Change to treat final variables the same as regular variables (i.e. not like constants). See VariableName Note [BREAKING CHANGE]
  • #​497: NoDef rule: Also check fields. The excludeRegex no longer requires (or expects) a method name to include '()'. [BREAKING CHANGE]
  • #​487: UnusedMethodParameter rule: Also check for unused parameters of constructors. [BREAKING CHANGE]
  • #​487: UnusedPrivateMethodParameter rule: Also check for unused parameters of constructors. [BREAKING CHANGE]
  • #​273: UnnecessaryToString rule: Add check for xx.toString() added (+) to a String constant; add check for GString expression ${xxx.toString()}. [BREAKING CHANGE]
  • #​518: MissingBlankLineAfterImports rule: Fix to add support for all import types. (René Scheibe)
  • #​521: SpaceAroundOperator rule: Fix incorrect violation if multiline ternary operation line contains a colon.
  • #​512: DuplicateStringLiteral and DuplicateNumberLiteral rules: Ignore duplicate values in annotations.
  • #​544: DuplicateStringLiteral rule: New duplicateStringMinimumLength property. (Nicolas Vuillamy)
  • #​544: DuplicateNumberLiteral rule: New duplicateNumberMinimumValue property. (Nicolas Vuillamy)
  • #​524: UnnecessarySemicolon rule: Also check field definitions.
  • #​534: UnnecessarySemicolon rule: Fix no violation in Groovy 3 if there is a space between code and the semicolon.
  • #​526: Indentation rule: CodeNarc fails while parsing Traits.
  • #​536: Indentation rule: Method chaining improvements. (Damir Murat)
  • #​540: Indentation rule: Fix false positive violation on inline anonymous classes.
  • #​551: TrailingWhitespace rule: Optimize execution time.
  • #​556: CodeNarcTask: Close URLClassLoader.

CodeNarc Plugin Mechanism

  • #​494: New CodeNarcPlugin
    • Add plugins property to the CodeNarc Ant Task (CodeNarcTask) and -plugins parameter to the command-line.
    • CodeNarcRunner: Apply plugins for rules, violations and reports. Register any plugin classes specified by the "org.codenarc.plugins" system property.
    • Add sourceCode property to FileResults; set it from FilesystemSourceAnalyzer and AntFileSetSourceAnalyzer.
  • #​538: Convert BaselineResultsProcessor to a plugin: BaselineResultsPlugin. Switch CodeNarcTask to use plugin. Remove ResultsProcessor classes.

Disabling Rules From Comments

  • #​156: Disable rules by specifying codenarc-disable in a comment; optionally re-enable by specifying codenarc-enable on a subsequent line. Disable rules for the current line with codenarc-disable-line.

RuleSets

Framework and Infrastructure

  • #​525: Upgrade to Groovy 2.5.12. [BREAKING CHANGE]
  • #​525: Support Java 14. Upgrade Java source/target compatibility to 1.7. [BREAKING CHANGE]
  • #​532: Remove support for changing (overriding) a rule name in “codenarc.properties”. [BREAKING CHANGE]
  • #​519: Update Gradle wrapper to 6.5. (René Scheibe)
  • #​520: Update Gradle publishing mechanism. (René Scheibe)
  • #​496: Switched CodeNarc website to publish from gh-pages branch.

Documentation

  • #​533: Update command-line instructions to use newer version of Groovy and other jars. Add a section on running with Gradle.

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

Copy link
Contributor Author

renovate bot commented Dec 1, 2023

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

Warning: custom changes will be lost.

@puneetbehl puneetbehl merged commit 1005a73 into 3.0.x Dec 4, 2023
2 checks passed
@guillermocalvo guillermocalvo deleted the renovate/major-codenarcversion branch December 4, 2023 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants