New features
- #16444: Add new
InternalAffairs/InvalidNodePatterncop. (@bbatsov) - #16454: Add new
InternalAffairs/NodeSearchAsConditioncop. (@bbatsov) - #16447: Add new
InternalAffairs/RedundantAutocorrectIncompatibleWithcop. (@bbatsov) - #16346: Support the experimental
prismvalue ofAllCops: ParserEngine, which builds the AST from Prism without its parser translation layer. (@bbatsov)
Bug fixes
- #16449: Fix a false negative for
Layout/FirstArgumentIndentationwhen the outer method call uses safe navigation. (@bbatsov) - #16451: Fix a false negative for
Style/ArrayCoercionwhen checking against::Array. (@bbatsov) - #16451: Fix a false negative for
Style/FetchEnvVarwhen using::ENV. (@bbatsov) - #16451: Fix a false negative for
Style/RedundantInterpolationUnfreezewhen using::String.new. (@bbatsov) - #16449: Fix a false negative for
Style/RedundantSortwhensort_bywith a block argument and an index method are called with safe navigation. (@bbatsov) - #16445: Fix a false positive for
Gemspec/RubyVersionGlobalsUsagewhen the file has no gem specification. (@bbatsov) - #16452: Fix a false positive for
Lint/DuplicateRequirewhenrequireis called on a namespaced constant namedKernel. (@bbatsov) - #16451: Fix a false positive for
Lint/ShadowingOuterLocalVariablewhen using::Ractor.new. (@bbatsov) - #16452: Fix a false positive for
Lint/UselessDefaultValueArgumentwhennewis called on a namespaced constant namedArray. (@bbatsov) - #16452: Fix a false positive for
Style/EmptyClassDefinitionwhennewis called on a namespaced constant namedClass. (@bbatsov) - #16505: Fix an incorrect autocorrect for
Layout/LineLengthwith a heredoc before a multiline endless method body. (@bbatsov) - #16322: Fix an incorrect autocorrect for
Layout/LineLengthwith an endless method with a heredoc. (@Starlexxx) - #16425: Fix an incorrect autocorrect for
Lint/NonAtomicFileOperationwiththen. (@koic) - #16490: Fix an incorrect autocorrect for
Lint/RedundantCopDisableDirectivewith a cop that becomes redundant after a correction. (@koic) - #16480: Fix an incorrect autocorrect for
Lint/RedundantStringCoercionwith a heredoc in the receiver. (@koic) - #16505: Fix an incorrect autocorrect for
Lint/RequireRelativeSelfPathwhen the value of the require is used. (@bbatsov) - #16441: Fix an incorrect autocorrect for
Lint/RequireRelativeSelfPathwith code on the same line. (@Starlexxx) - #16416: Fix an incorrect autocorrect for
Lint/UselessAssignmentwith the first argument of a method call without parentheses. (@koic) - #16505: Fix an incorrect autocorrect for
Lint/UselessTimeswith a heredoc or arescueclause in the block. (@bbatsov) - #16479: Fix an incorrect autocorrect for
Lint/UselessTimeswith an inconsistently indented body. (@koic) - #16437: Fix an incorrect autocorrect for
Style/EmptyClassDefinitionwith ado...endblock command call. (@koic) - #16466: Fix an incorrect autocorrect for
Style/EmptyMethodwith a heredoc. (@Starlexxx) - #16426: Fix an incorrect autocorrect for
Style/FileWritewith code after a heredoc argument. (@koic) - #16403: Fix an incorrect autocorrect for
Style/Forwith a trailing comma in the loop variable. (@Starlexxx) - #16434: Fix an incorrect autocorrect for
Style/MultilineMethodSignaturewithStyle/MethodDefParentheses. (@koic) - #16415: Fix an incorrect autocorrect for
Style/MultilineTernaryOperatorwith a heredoc. (@koic) - #16505: Fix an incorrect autocorrect for
Style/NonNilCheckwith a heredoc opened before the receiver. (@bbatsov) - #16421: Fix an incorrect autocorrect for
Style/OperatorMethodCallwithStyle/TrailingCommaInArguments. (@Starlexxx) - #16421: Fix an incorrect autocorrect for
Style/OperatorMethodCallwith a trailing comma. (@Starlexxx) - #16470: Fix an incorrect autocorrect for
Style/RaiseArgswith a trailing comma after a heredoc. (@koic) - #16462: Fix an incorrect autocorrect for
Style/RedundantArrayConstructorwithStyle/TrailingCommaInArguments. (@Starlexxx) - #16463: Fix an incorrect autocorrect for
Style/RedundantArrayConstructorwith a comment or heredoc outside the array literal. (@Starlexxx) - #16478: Fix an incorrect autocorrect for
Style/RedundantBeginwith code after a modifier condition. (@koic) - #16505: Fix an incorrect autocorrect for
Style/RedundantEachwith.eachon its own line. (@bbatsov) - #16464: Fix an incorrect autocorrect for
Style/RedundantExceptionwith a heredoc or comment in the removed source. (@Starlexxx) - #16469: Fix an incorrect autocorrect for
Style/RedundantInitializewith a method definition used as a value. (@koic) - #16471: Fix an incorrect autocorrect for
Style/RedundantInterpolationUnfreezewithStyle/TrailingCommaInArguments. (@koic) - #16468: Fix an incorrect autocorrect for
Style/StructInheritanceandStyle/DataInheritancewith code afterend. (@koic) - #16435: Fix an infinite loop for
Layout/EmptyLinesAroundAccessModifierwith a conditional access modifier in a block. (@koic) - #16436: Fix an infinite loop for
Layout/EmptyLinesAroundClassBodyandLayout/EmptyLinesAroundModuleBodywith a statement on the class line. (@koic) - #16497: Avoid dropping heredoc bodies when correcting
Style/DigChain. (@Starlexxx) - #16494: Avoid dropping heredocs and comments when correcting
Style/RedundantRegexpConstructor. (@Starlexxx) - #16481: Avoid
Style/EachWithObjectwhennextchanges the accumulator. (@Starlexxx) - #16450: Fix false negatives for
Style/ArgumentsForwardingwhen anonymous arguments are all forwarded in a singleton method or with safe navigation. (@bbatsov) - #16448: Fix false negatives for
Style/FileReadwhen the block uses a numbered parameter orit. (@bbatsov) - #16448: Fix false negatives for
Style/FileWritewhen the block uses a numbered parameter orit. (@bbatsov) - #16448: Fix false negatives for
Style/HashTransformKeysandStyle/HashTransformValueswhen the receiver is a block that uses a numbered parameter orit. (@bbatsov) - #16503: Fix false positives for
Lint/DuplicateMethodswhen a method is redefined afterundef,undef_method, orremove_method. (@APX403) - #16452: Fix false positives for
Style/HashTransformKeysandStyle/HashTransformValueswhen[]is called on a namespaced constant namedHash. (@bbatsov) - #16473: Preserve code after
endwhenStyle/SoleNestedConditionalmerges conditions. (@Starlexxx) - #16487: Preserve code sharing the
elseline inStyle/NegatedIfElseCondition. (@Starlexxx) - #16493: Preserve escaped quotes when correcting
Style/RedundantPercentQwithStyle/RedundantStringEscape. (@Starlexxx) - #16484: Preserve heredoc bodies in
Style/ArrayIntersectcorrections. (@Starlexxx) - #16486: Preserve heredoc bodies in
Style/NilComparisoncorrections. (@Starlexxx) - #16483: Preserve heredoc bodies in
Style/NonNilCheckcorrections. (@Starlexxx) - #16489: Preserve heredoc bodies in
Style/RedundantInterpolationcorrections. (@Starlexxx) - #16496: Preserve heredoc keys when correcting
Style/SingleArgumentDig. (@Starlexxx) - #16485: Preserve heredocs and comments in
Lint/NumberConversioncorrections. (@Starlexxx) - #16501: Preserve heredocs and comments when correcting
Lint/LambdaWithoutLiteralBlock. (@Starlexxx) - #16500: Preserve heredocs and comments when correcting
Lint/UselessNumericOperation. (@Starlexxx) - #16502: Preserve heredocs and comments when correcting
Style/RedundantSelfAssignment. (@Starlexxx) - #16488: Preserve neighboring statements in
Style/SwapValuescorrections. (@Starlexxx) - #16482: Preserve non-local
breakinStyle/NilLambda. (@Starlexxx) - #16498: Preserve source between calls when correcting
Style/RedundantEach. (@Starlexxx) - #16476: Replace only block argument references in
Lint/UselessTimes. (@Starlexxx) - #16504: Fix
TargetRubyVersionnot being validated in a configuration file given with--config. (@bbatsov)
Changes
- #16346: Report a
ParserEnginethat cannot parse the target Ruby version, or that needs theparsergem when it is not installed, as a configuration error instead of a backtrace. (@bbatsov) - #16346: Require RuboCop AST 1.54, which makes
prismthe default parser engine for Ruby 3.3+ when Prism 2.0 or later is installed. (@bbatsov) - #16346: Make
Cop::Base#parseuse the Ruby version and the parser engine of the source under investigation. (@bbatsov) - #16346: Parse the gemspec file with Prism when looking for the target Ruby version, unless
ParserEngineisparser_whitequark. (@bbatsov) - #16346: Make
rubocop -Vshow the parser engine that is used whenAllCops: ParserEngineis not set. (@bbatsov)