New features
- #15895: Add an MCP tool that explains what cops do. (@bbatsov)
- #15700: Add
--explain COPto describe what a cop does, how it is configured, and the examples from its documentation. (@bbatsov) - #15699: Add
--max-offenses-per-copto cap how many offenses a single cop reports. (@bbatsov) - #15948: Let MCP autocorrection apply the corrections of
AutoCorrect: contextualcops when asked to. (@bbatsov) - #15945: Let MCP autocorrection preview its changes as a diff. (@bbatsov)
- #15915: Let MCP inspection cap how many offenses each cop reports. (@bbatsov)
- #15930: Let MCP tools choose which cops run and which files they check. (@bbatsov)
- #14666: Make
Lint/UselessAssignmentregister an offense for a block-captured variable that is never referenced. (@IslamElsayed) - #15695: Report autocorrection edits in the JSON formatter. (@bbatsov)
- #15940: Report cop errors and warnings per file in
--format json. (@bbatsov) - #15945: Report the offenses MCP autocorrection leaves behind. (@bbatsov)
Bug fixes
- #15780: Fix an error for
Lint/MissingCopEnableDirectivewhen anenable-nextornext +Copdirective suspends an openrubocop:disable, and a false positive fornext -Copscopes larger thanMaxRangeSize. (@bbatsov) - #16005: Fix a false negative for
Security/JSONLoadwithcreate_additionsas the second argument. (@bbatsov) - #15994: Fix a false positive for
Layout/LineEndStringConcatenationIndentationwith an already aligned part. (@bbatsov) - #15842: Fix a false positive for
Style/ExplicitBlockArgumentwhen the method uses argument forwarding (...). (@bbatsov) - #15843: Fix a false positive for
Style/NegativeArrayIndexwith a different length receiver. (@bbatsov) - #15841: Fix a false positive for
Style/RedundantFreezewith an arithmetic operation on a non-numeric receiver. (@bbatsov) - #15843: Fix a false positive for
Style/Samplewith an endless range, which was corrected to asamplecall of the wrong size. (@bbatsov) - #15842: Fix a false positive for
Style/SuperArgumentswhen the method has a destructuring parameter. (@bbatsov) - #15740: Fix an error for
Layout/EmptyLinesAroundMethodBodywhen a method's arguments span multiple lines and the method ends on the last argument's line. (@viralpraxis) - #15860: Fix an error for
Layout/HeredocIndentationwith a heredoc nested in another heredoc. (@Starlexxx) - #15876: Fix an error for
Lint/EmptyConditionalBodywithelseon the condition line. (@koic) - #16008: Fix an error for
Lint/UnescapedBracketInRegexpwhen using regexp_parser 2.11.2 and earlier. (@bbatsov) - #15897: Fix an error for
Metrics/ClassLengthwith a long singleton class in LSP mode. (@bbatsov) - #15749: Fix an error for
Style/ClassAndModuleChildrenwhen a compact class or module definition appears in an expression, such as an assignment value or a method argument. (@viralpraxis) - #15750: Fix an error for
Style/ClassAndModuleChildrenwhen usingEnforcedStyle: compactand the nested body is indented less thanLayout/IndentationWidth'sWidth. (@viralpraxis) - #15764: Fix an error for
Style/ClassAndModuleChildrenwhenEnforcedStyle: compactcompacts an irregularly indented definition andLayout/IndentationStyleenforces tabs. (@viralpraxis) - #15946: Fix an error for
Style/ExplicitBlockArgumentwith the shorthand call syntax. (@Starlexxx) - #15861: Fix an error for
Style/FormatStringwithformatnested informat. (@Starlexxx) - #15694: Fix an error for
Style/HashSyntaxwhen ano_mixed_keysstyle forces hash rockets on a hash whose value repeats its key. (@viralpraxis) - #16007: Fix an error for
Style/IfInsideElsewhen the nestedifshares a line with other code. (@bbatsov) - #15867: Fix an error for
Style/MapIntoArraywhen pushing into a numbered oritblock parameter. (@Starlexxx) - #15949: Fix an error for
Style/Nextwith a modifier condition wrapping a block that has its own offense. (@Starlexxx) - #15797: Fix an error for
Style/RedundantConditionwhen autocorrecting a redundant condition nested in theelsebranch of another one. (@koic) - #15928: Fix an error for
Style/Semicolonwhen a semicolon follows an unparenthesized keyword parameter or hash pattern. (@viralpraxis) - #15714: Fix an error for
Style/YodaConditionwhen one operand of a comparison contains another comparison the cop also corrects. (@viralpraxis) - #16011: Fix an error for the
pacmanformatter, which crashed withundefined method 'winsize'whether or not the output was a terminal. (@bbatsov) - #15731: Fix an error when caching offenses whose correction or justification cannot be represented as UTF-8. (@viralpraxis)
- #16015: Fix an error when cleaning up a result cache that can't be written. (@bbatsov)
- #15702: Fix an error when interrupting RuboCop with
Ctrl-C. (@viralpraxis) - #16015: Fix an error when the cache directory or config can't be accessed under a sandbox. (@bbatsov)
- #16015: Fix an error when the result cache directory exists but can't be written. (@bbatsov)
- #15817: Fix an incorrect autocorrect for
Gemspec/OrderedDependencieswhen the same dependency declaration appears more than once in the gemspec. (@viralpraxis) - #15903: Fix an incorrect autocorrect for
Layout/ClassStructurewith blank line cops. (@koic) - #15984: Fix an incorrect autocorrect for
Layout/ClassStructurewithLayout/EmptyLinesAroundAccessModifier. (@koic) - #15997: Fix an incorrect autocorrect for
Layout/ClassStructurewith a heredoc constant. (@bbatsov) - #15697: Fix an incorrect autocorrect for
Layout/EmptyLinesAroundBlockBodywhen usingEnforcedStyle: empty_linesand the empty line would precede a leading dot method call. (@viralpraxis) - #15953: Fix an incorrect autocorrect for
Layout/EmptyLinesAroundBlockBodywithdoon its own line. (@koic) - #15818: Fix an incorrect autocorrect for
Layout/ExtraSpacingcop withForceEqualSignAlignment: truewhenStyle/SelfAssignmentrewrites the same assignment. (@Starlexxx) - #15997: Fix an incorrect autocorrect for
Layout/FirstArgumentIndentationwith an inner call not beginning its line. (@bbatsov) - #15904: Fix an incorrect autocorrect for
Layout/FirstMethodArgumentLineBreakwithStyle/MethodCallWithArgsParentheses. (@koic) - #15875: Fix an incorrect autocorrect for
Layout/FirstMethodParameterLineBreakwithStyle/MethodDefParentheses. (@koic) - #15793: Fix an incorrect autocorrect for
Layout/LineContinuationSpacingcop when a line ends with the$\global variable. (@Starlexxx) - #15656: Fix an incorrect autocorrect for
Layout/LineLengthwhen breaking a line after an argument with a nested heredoc. (@Starlexxx) - #15844: Fix an incorrect autocorrect for
Layout/LineLengthcop whenStyle/MethodCallWithArgsParentheseswithEnforcedStyle: omit_parenthesesremoves the parentheses it breaks after. (@Starlexxx) - #15813: Fix an incorrect autocorrect for
Layout/LineLengthwhenSplitStrings: truewould split a string inside an escape sequence such as\000. (@koic) - #15777: Fix an incorrect autocorrect for
Layout/LineLengthwithSplitStrings: truewhen an interpolation in the string contains a block. (@Starlexxx) - #15997: Fix an incorrect autocorrect for
Layout/LineLengthwithSplitStringsand a string not beginning its line. (@bbatsov) - #15964: Fix an incorrect autocorrect for
Layout/MultilineArrayBraceLayoutwithLayout/MultilineHashBraceLayoutandLayout/MultilineMethodCallBraceLayout. (@koic) - #15966: Fix an incorrect autocorrect for
Layout/MultilineArrayBraceLayoutwithStyle/ConcatArrayLiterals. (@koic) - #15789: Fix an incorrect autocorrect for
Layout/MultilineBlockLayoutcop adding a trailing comma when the only positional block argument is followed by keyword arguments. (@Starlexxx) - #15955: Fix an incorrect autocorrect for
Layout/MultilineBlockLayoutwith block argument rewriting cops. (@koic) - #15932: Fix an incorrect autocorrect for
Layout/MultilineHashBraceLayoutwithStyle/HashAsLastArrayItemandStyle/RedundantDoubleSplatHashBraces. (@koic) - #15906: Fix an incorrect autocorrect for
Layout/MultilineArrayLineBreaks,Layout/MultilineHashKeyLineBreaks,Layout/MultilineMethodArgumentLineBreaksandLayout/MultilineMethodParameterLineBreaksafter a heredoc opener. (@koic) - #15748: Fix an incorrect autocorrect for
Layout/MultilineMethodCallBraceLayoutwhenEnforcedStyle: omit_parenthesesofStyle/MethodCallWithArgsParenthesesremoves the parentheses the layout cop is moving. (@koic) - #15870: Fix an incorrect autocorrect for
Layout/MultilineMethodDefinitionBraceLayoutwithStyle/MultilineMethodSignature. (@Starlexxx) - #15967: Fix an incorrect autocorrect for
Layout/SingleLineBlockChainwithStyle/NilComparison. (@koic) - #15988: Fix an incorrect autocorrect for
Layout/SingleLineBlockChainwithStyle/FloatDivision. (@koic) - #15865: Fix an incorrect autocorrect for
Layout/SingleLineBlockChainwith a heredoc. (@Starlexxx) - #15735: Fix an incorrect autocorrect for
Layout/SpaceInsideBlockBraceswithEnforcedStyle: no_spacewhen a multiline block's last line has code before the closing bracket. (@viralpraxis) - #15838: Fix an incorrect autocorrect for
Lint/AmbiguousOperatorwithStyle/ArgumentsForwarding. (@bbatsov) - #15913: Fix an incorrect autocorrect for
Lint/EmptyConditionalBodywith an emptyelsifandelse. (@koic) - #15971: Fix an incorrect autocorrect for
Lint/LiteralInInterpolationwith a#next to the interpolation. (@koic) - #15999: Fix an incorrect autocorrect for
Lint/LiteralInInterpolationwith an empty literal after a#. (@bbatsov) - #16004: Fix an incorrect autocorrect for
Lint/LiteralInInterpolationwith two adjacent interpolations. (@bbatsov) - #15795: Fix an incorrect autocorrect for
Lint/Loopwhenbegin ... end whileorbegin ... end untilis written on a single line. (@koic) - #15889: Fix an incorrect autocorrect for
Lint/NumberConversionwith a symbol operand of an operator. (@koic) - #15934: Fix an incorrect autocorrect for
Lint/RedundantDirGlobSortwith a leading dot. (@koic) - #16007: Fix an incorrect autocorrect for
Lint/UnescapedBracketInRegexpwith a double-quotedRegexp.newstring. (@bbatsov) - #16007: Fix an incorrect autocorrect for
Lint/UnescapedBracketInRegexpwith an escapedRegexp.newstring. (@bbatsov) - #15838: Fix an incorrect autocorrect for
Lint/UselessAssignmentwith a list of values without brackets. (@bbatsov) - #15796: Fix an incorrect autocorrect for
Lint/Voidwhen removing a heredoc in void context, so that its body and terminator are removed with it. (@koic) - #15832: Fix an incorrect autocorrect for
Layout/MultilineArrayBraceLayout,Layout/MultilineHashBraceLayout,Layout/MultilineMethodCallBraceLayout, andLayout/MultilineMethodDefinitionBraceLayoutwhen a heredoc is opened on the line of the closing brace. (@koic) - #15952: Fix an incorrect autocorrect for
Naming/HeredocDelimiterCasewhen the body has the corrected delimiter. (@koic) - #15800: Fix an incorrect autocorrect for
Style/AccessModifierDeclarationswith a splatted variable. (@koic) - #15801: Fix an incorrect autocorrect for
Style/Aliaswhen a symbol argument such as:"foo bar"or:@typehas no bareword form. (@koic) - #15991: Fix an incorrect autocorrect for
Style/AndOrwithStyle/ReturnNilInPredicateMethodDefinition. (@Starlexxx) - #15962: Fix an incorrect autocorrect for
Style/ArgumentsForwardingadding parentheses twice to a method definition. (@Starlexxx) - #15893: Fix an incorrect autocorrect for
Style/ArgumentsForwardingwith a block literal. (@koic) - #15843: Fix an incorrect autocorrect for
Style/Attrwith parenthesized arguments. (@bbatsov) - #15727: Fix an incorrect autocorrect for
Style/BlockDelimiterswhen a braces block is the collection of aforloop. (@viralpraxis) - #15758: Fix an incorrect autocorrect for
Style/BlockDelimiterswhenStyle/MethodCallWithArgsParentheseswithEnforcedStyle: omit_parenthesesremoves the call's parentheses in the same pass, producing invalid code such asfoo :bar { baz }. (@viralpraxis) - #15838: Fix an incorrect autocorrect for
Style/BlockDelimiterswith a block in a loop condition. (@bbatsov) - #15842: Fix an incorrect autocorrect for
Style/BlockDelimiterswith a multiline block in an argument ofyieldorsuperwithout parentheses. (@bbatsov) - #15975: Fix an incorrect autocorrect for
Style/BlockDelimiterswith a heredoc afterrescue. (@koic) - #15747: Fix an incorrect autocorrect for
Style/BlockDelimiterswithLayout/SpaceBeforeBlockBraces. (@koic) - #15840: Fix an incorrect autocorrect for
Style/CaseLikeIfwith anifinside theelsebranch. (@bbatsov) - #15730: Fix an incorrect autocorrect for
Style/ClassAndModuleChildrenwithEnforcedStyle: compactwhen a one-liner child class has a superclass or a body. (@viralpraxis) - #15961: Fix an incorrect autocorrect for
Style/ClassAndModuleChildrenwhen compacting a nested definition. (@Starlexxx) - #15943: Fix an incorrect autocorrect for
Style/ClassAndModuleChildrenwithStyle/StructInheritance. (@koic) - #15744: Fix an incorrect autocorrect for
Style/ClassMethodsDefinitionswhen a method definition insideclass << selfis followed by other code on its last line. (@viralpraxis) - #15922: Fix an incorrect autocorrect for
Style/CombinableLoopswhen followed by another block. (@Starlexxx) - #15996: Fix an incorrect autocorrect for
Style/CombinableLoopswhen one of the loops is disabled. (@bbatsov) - #16006: Fix an incorrect autocorrect for
Style/CombinableLoopswith comments after the loop's opening. (@bbatsov) - #16006: Fix an incorrect autocorrect for
Style/CombinableLoopswith comments before the closing delimiter. (@bbatsov) - #15987: Fix an incorrect autocorrect for
Style/CombinableLoopswith mixed block delimiters. (@koic) - #15996: Fix an incorrect autocorrect for
Style/CombinableLoopswith numbered anditparameters. (@bbatsov) - #15878: Fix an incorrect autocorrect for
Style/CombinableLoopswithrescuein a loop body. (@koic) - #16004: Fix an incorrect autocorrect for
Style/ConcatArrayLiteralsdropping comments. (@bbatsov) - #15834: Fix an incorrect autocorrect for
Style/ConcatArrayLiteralswithStyle/MethodCallWithArgsParentheses. (@koic) - #15881: Fix an incorrect autocorrect for
Style/ConcatArrayLiteralswithStyle/TrailingCommaInArguments. (@koic) - #15999: Fix an incorrect autocorrect for
Style/ConcatArrayLiteralswith multiline array arguments. (@bbatsov) - #15773: Fix an incorrect autocorrect for
Style/ConditionalAssignmentwithEnforcedStyle: assign_inside_conditionwhenStyle/MethodCallWithArgsParentheseswithEnforcedStyle: omit_parenthesesremoves a branch body's parentheses in the same pass, producing invalid code such asfoo << bar :baz. (@viralpraxis) - #15863: Fix an incorrect autocorrect for
Style/EmptyLiteralwhenHash[]orHash([])is the first argument of a method call without parentheses. (@kevin9327) - #15689: Fix an incorrect autocorrect for
Style/EndlessMethodwhen a method is made endless whileStyle/MethodCallWithArgsParenthesesomits parentheses in its body. (@viralpraxis) - #16014: Fix an incorrect autocorrect for
Style/EndlessMethodandStyle/SingleLineMethodswith a one-line pattern match orbegin...end whilebody. (@bbatsov) - #15715: Fix an incorrect autocorrect for
Style/EndlessMethodwhen the method body ends with an anonymous argument forwarding. (@viralpraxis) - #15710: Fix an incorrect autocorrect for
Style/EndlessMethodwhen the method body passes a multiline or xstring heredoc to a method call. (@viralpraxis) - #15716: Fix an incorrect autocorrect for
Style/EndlessMethodwhen the method body is a multiple assignment. (@viralpraxis) - #15707: Fix an incorrect autocorrect for
Style/EndlessMethodwhen the method body ends with an omitted hash value. (@viralpraxis) - #15831: Fix an incorrect autocorrect for
Style/EndlessMethodwith a command that an endless body cannot hold. (@koic) - #15815: Fix an incorrect autocorrect for
Style/EndlessMethoddeleting a comment placed between the method signature andend. (@koic) - #15992: Fix an incorrect autocorrect for
Style/EndlessMethodwith a modifier condition orand/orbody. (@Starlexxx) - #15775: Fix an incorrect autocorrect for
Style/EndlessMethodwhenNaming/BlockForwardingorStyle/ArgumentsForwardingadds parentheses to the same method definition. (@Starlexxx) - #15842: Fix an incorrect autocorrect for
Style/EndlessMethodandStyle/SingleLineMethodswhen the method body assigns multiple values without brackets. (@bbatsov) - #15756: Fix an incorrect autocorrect for
Style/EndlessMethodwhen the method parameters are not surrounded by parentheses. (@koic) - #15843: Fix an incorrect autocorrect for
Style/ExactRegexpMatchwhen the result is used. (@bbatsov) - #15790: Fix an incorrect autocorrect for
Style/ExplicitBlockArgumentcop when the method already has an argument or local variable namedblock. (@Starlexxx) - #15963: Fix an incorrect autocorrect for
Style/ExplicitBlockArgumentwithStyle/LambdaCall. (@koic) - #15965: Fix an incorrect autocorrect for
Style/ExplicitBlockArgumentwithStyle/TrailingCommaInArguments. (@koic) - #15998: Fix an incorrect autocorrect for
Style/ExplicitBlockArgumentwith an empty index call. (@bbatsov) - #15842: Fix an incorrect autocorrect for
Style/ExplicitBlockArgumentwhensuperwithout arguments is called in a method with keyword or block parameters. (@bbatsov) - #15977: Fix an incorrect autocorrect for
Style/FloatDivisionwith a leading dot. (@koic) - #15768: Fix an incorrect autocorrect for
Style/ForwhenEnforcedStyle: forand the block body abuts a brace, such asc.each {d}, which leftdoorendglued to the body. (@viralpraxis) - #15765: Fix an incorrect autocorrect for
Style/ForwhenEnforcedStyle: forand the multilineeachblock is delimited by braces. (@viralpraxis) - #15911: Fix an incorrect autocorrect for
Style/Forwith ado...endblock in the collection. (@koic) - #15838: Fix an incorrect autocorrect for
Style/Forwith a non-local loop variable or an implicit block parameter. (@bbatsov) - #15882: Fix an incorrect autocorrect for
Style/ForwithStyle/RedundantBegin. (@koic) - #15970: Fix an incorrect autocorrect for
Style/FormatStringwith a braced hash argument. (@koic) - #15842: Fix an incorrect autocorrect for
Style/FormatStringwhen the argument ofString#%is an instance variable, a constant or another value that may be an array. (@bbatsov) - #15799: Fix an incorrect autocorrect for
Style/FrozenStringLiteralCommentwhen an encoding magic comment names an encoding other than UTF-8, so that the frozen string literal comment is inserted below it. (@koic) - #15840: Fix an incorrect autocorrect for
Style/GuardClausewith anifas the body of an endless method. (@bbatsov) - #15998: Fix an incorrect autocorrect for
Style/HashConversionin an index, setter or operator call. (@bbatsov) - #15998: Fix an incorrect autocorrect for
Style/HashConversionwhen calling a method onHash[]. (@bbatsov) - #15973: Fix an incorrect autocorrect for
Style/HashConversionwithStyle/MethodCallWithArgsParentheses. (@koic) - #15998: Fix an incorrect autocorrect for
Style/HashConversionwith a method chain argument. (@bbatsov) - #15998: Fix an incorrect autocorrect for
Style/HashConversionwith safe navigation,superoryield. (@bbatsov) - #15698: Fix an incorrect autocorrect for
Style/HashLookupMethodwhen the lookup is the target of a compound assignment. (@viralpraxis) - #15951: Fix an incorrect autocorrect for
Style/HashLookupMethodwith a leading dot. (@koic) - #15944: Fix an incorrect autocorrect for
Style/HashLookupMethodwith an explicit element reference call. (@koic) - #15772: Fix an incorrect autocorrect for
Style/HashSyntaxwithEnforcedStyle: hash_rocketswhere expanding an omitted hash value also removed the line break that followed it. (@viralpraxis) - #15862: Fix an incorrect autocorrect for
Style/HashSyntaxwithStyle/MethodCallWithArgsParentheses. (@Starlexxx) - #15972: Fix an incorrect autocorrect for
Style/HashSyntaxwithStyle/SuperWithArgsParentheses. (@koic) - #15879: Fix an incorrect autocorrect for
Style/HashSyntaxwith a keyword-named shorthand value. (@koic) - #15869: Fix an incorrect autocorrect for
Style/IdenticalConditionalBrancheswhen a duplicated expression shares its line. (@koic) - #16007: Fix an incorrect autocorrect for
Style/IfInsideElsewith a modifierifon theelseline. (@bbatsov) - #15840: Fix an incorrect autocorrect for
Style/IfUnlessModifierOfIfUnlesswithStyle/SoleNestedConditional. (@bbatsov) - #16000: Fix an incorrect autocorrect for
Style/IfUnlessModifierwith a heredoc inside another heredoc. (@bbatsov) - #15979: Fix an incorrect autocorrect for
Style/IfUnlessModifierwith a heredoc nested in the body. (@koic) - #15840: Fix an incorrect autocorrect for
Style/IfUnlessModifierandStyle/WhileUntilModifierwith a conditional or loop in a call argument, ternary branch or endless method body. (@bbatsov) - #15907: Fix an incorrect autocorrect for
Style/IfUnlessModifierwith an omitted hash value in areturnor an assignment. (@koic) - #15852: Fix an incorrect autocorrect for
Style/IfWithSemicolonwhenifis the receiver of a method call or an operand of an operator. (@koic) - #15854: Fix an incorrect autocorrect for
Style/IfWithSemicolonwhen a branch is abegin/endloop with awhileoruntilmodifier. (@koic) - #15850: Fix an incorrect autocorrect for
Style/IfWithSemicolonwhen!is applied to a method call with unparenthesized arguments. (@koic) - #15839: Fix an incorrect autocorrect for
Style/IfWithSemicolonwhen the condition or a branch binds looser than the ternary operator. (@bbatsov) - #15941: Fix an incorrect autocorrect for
Style/InverseMethodswith an operand of an operator. (@koic) - #15708: Fix an incorrect autocorrect for
Style/ItBlockParameterwhen usingEnforcedStyle: alwaysand the block parameter is used inside a nested block. (@viralpraxis) - #15954: Fix an incorrect autocorrect for
Style/ItBlockParameterwithStyle/StabbyLambdaParentheses. (@koic) - #15859: Fix an incorrect autocorrect for
Style/ItBlockParameterwithStyle/Lambda. (@Starlexxx) - #15912: Fix an incorrect autocorrect for
Style/KeywordParametersOrderwith trailing whitespace. (@koic) - #15718: Fix an incorrect autocorrect for
Style/Lambdawhen a lambda literal has an argument whose default value needs parentheses between pipes. (@viralpraxis) - #15986: Fix an incorrect autocorrect for
Style/LambdaCallwith a heredoc argument. (@Starlexxx) - #15978: Fix an incorrect autocorrect for
Style/Lambdawith a lambda literal in a pattern. (@koic) - #15887: Fix an incorrect autocorrect for
Style/Lambdawithrescuein an unparenthesized argument. (@koic) - #15826: Fix an incorrect autocorrect for
Style/MethodCallWithArgsParentheseswhenStyle/TernaryParenthesesalso parenthesizes the arguments of a ternary condition. (@koic) - #15812: Fix an incorrect autocorrect for
Style/MethodCallWithArgsParentheseswithEnforcedStyle: omit_parentheseswhenStyle/AndOrrewrites theand/orkeyword around an argument-bearing call in the same pass. (@koic) - #15833: Fix an incorrect autocorrect for
Style/MethodCallWithArgsParentheseswhenStyle/RedundantParenthesesremoves the parentheses around a call whose own parentheses are omitted in the same pass. (@koic) - #15824: Fix an incorrect autocorrect for
Style/MethodCallWithArgsParentheseswithEnforcedStyle: omit_parentheseswhen a call is assigned before theandororkeyword. (@koic) - #15905: Fix an incorrect autocorrect for
Style/MethodCallWithArgsParentheseswith a closing parenthesis on its own line. (@koic) - #15974: Fix an incorrect autocorrect for
Style/MethodCallWithArgsParentheseswith a nested call at the end of the line. (@koic) - #15999: Fix an incorrect autocorrect for
Style/MethodCallWithArgsParentheseswith a comment after(. (@bbatsov) - #4524: Fix an incorrect autocorrect for
Style/MethodCallWithoutArgsParentheseswhen a local variable has the same name. (@bbatsov) - #15696: Fix an incorrect autocorrect for
Style/MethodDefParentheseswhen usingEnforcedStyle: require_no_parenthesesand the parameters begin on a line below the method name. (@viralpraxis) - #15888: Fix an incorrect autocorrect for
Style/MethodDefParentheseswith a destructured first parameter. (@koic) - #15914: Fix an incorrect autocorrect for
Style/MethodDefParentheseswith a single-line method body. (@koic) - #16000: Fix an incorrect autocorrect for
Style/MultilineIfModifierwith a heredoc opened on the modifier line. (@bbatsov) - #16006: Fix an incorrect autocorrect for
Style/MultilineIfModifierwith a multiline string in the body. (@bbatsov) - #16006: Fix an incorrect autocorrect for
Style/MultilineIfModifierwith a non-squiggly heredoc in the body. (@bbatsov) - #15969: Fix an incorrect autocorrect for
Style/MultilineInPatternThenwith an endless range pattern. (@Starlexxx) - #15848: Fix an incorrect autocorrect for
Style/MultilineTernaryOperatorwithdefined?without parentheses. (@koic) - #15839: Fix an incorrect autocorrect for
Style/MultilineTernaryOperatorwithyieldandsuper. (@bbatsov) - #15969: Fix an incorrect autocorrect for
Style/MultilineWhenThenwith an endless range condition. (@Starlexxx) - #15902: Fix an incorrect autocorrect for
Style/MutableConstantwithRecursive: trueand trailing comma cops. (@koic) - #15840: Fix an incorrect autocorrect for
Style/NegatedIfElseConditionwiththenor a semicolon after the condition. (@bbatsov) - #15840: Fix an incorrect autocorrect for
Style/NestedModifierwith low-precedence operands. (@bbatsov) - #15839: Fix an incorrect autocorrect for
Style/NestedTernaryOperatorwhen the ternary followsreturnor is a command argument, or when theifbranch has parentheses that do not wrap all of it. (@bbatsov) - #15864: Fix an incorrect autocorrect for
Style/NestedTernaryOperatorwith a heredoc. (@Starlexxx) - #15847: Fix an incorrect autocorrect for
Style/NestedTernaryOperatorwhen the ternary is the operand ofnotordefined?without parentheses. (@koic) - #15841: Fix an incorrect autocorrect for
Style/Nextwith heredocs and multiline string literals. (@bbatsov) - #15830: Fix an incorrect autocorrect for
Style/NilComparisonwhen a method is called onnil?. (@koic) - #15960: Fix an incorrect autocorrect for
Style/NilComparisonwith a leading dot. (@koic) - #15806: Fix an incorrect autocorrect for
Style/NonNilCheckwhen the receiver is a unary operation, such as!a != nil. (@viralpraxis) - #15827: Fix an incorrect autocorrect for
Style/Notwith a unary~operand. (@koic) - #15807: Fix an incorrect autocorrect for
Style/NumericPredicatewhen the receiver is a unary operation, such as-a < 0. (@viralpraxis) - #15886: Fix an incorrect autocorrect for
Style/NumericPredicatewithEnforcedStyle: comparisonin an operand. (@koic) - #15849: Fix an incorrect autocorrect for
Style/OneLineConditionalwith a post-condition loop branch. (@koic) - #15851: Fix an incorrect autocorrect for
Style/OneLineConditionalwith a constant scope or a ternary condition. (@koic) - #15839: Fix an incorrect autocorrect for
Style/OneLineConditionalwhen a branch uses a modifierrescue/while/untilor a one-line pattern match, or when the conditional is the receiver of a method call. (@bbatsov) - #15843: Fix an incorrect autocorrect for
Style/PercentLiteralDelimiterswith an escaped delimiter. (@bbatsov) - #15835: Fix an incorrect autocorrect for
Style/ReduceToHashwith a key or a value that is not an array element. (@koic) - #15841: Fix an incorrect autocorrect for
Style/RedundantBeginwith low precedence statements and multilinereturnvalues. (@bbatsov) - #15841: Fix an incorrect autocorrect for
Style/RedundantConditionwith a low precedenceelsebranch. (@bbatsov) - #15841: Fix an incorrect autocorrect for
Style/RedundantConditionwith operator method branches. (@bbatsov) - #15909: Fix an incorrect autocorrect for
Style/RedundantDoubleSplatHashBraceswithStyle/TrailingCommaInHashLiteral. (@koic) - #15841: Fix an incorrect autocorrect for
Style/RedundantExceptionwith a compound message. (@bbatsov) - #15663: Fix an incorrect autocorrect for
Style/RedundantFetchBlockwhenfetchis called with a splat, an anonymous rest argument, or keyword arguments. (@ihamzatarar) - #15811: Fix an incorrect autocorrect for
Style/RedundantParentheseswith a heredoc and a chained call. (@koic) - #15825: Fix an incorrect autocorrect for
Style/RedundantParentheseswith a heredoc opened on the closing parenthesis line. (@koic) - #15798: Fix an incorrect autocorrect for
Style/RedundantRegexpArgumentwith an escaped#{. (@koic) - #15843: Fix an incorrect autocorrect for
Style/RedundantRegexpConstructorwith an ambiguous slash regexp. (@bbatsov) - #15810: Fix an incorrect autocorrect for
Style/RedundantRegexpEscapecop whenStyle/RegexpLiteralchanges the delimiters of the same regexp in the same pass. (@Starlexxx) - #15819: Fix an incorrect autocorrect for
Style/RegexpLiteralwhen a%rliteral whose body starts with a newline is passed to a method without parentheses. (@koic) - #15809: Fix an incorrect autocorrect for
Style/RegexpLiteralwith a slash inside an interpolation. (@koic) - #15823: Fix an incorrect autocorrect for
Style/RegexpLiteralwhen a%rliteral escapes its own delimiter in the body. (@koic) - #15993: Fix an incorrect autocorrect for
Style/RequireOrderwith arequiresharing its line. (@Starlexxx) - #15843: Fix an incorrect autocorrect for
Style/RescueModifierwith a nested heredoc. (@bbatsov) - #15991: Fix an incorrect autocorrect for
Style/ReturnNilInPredicateMethodDefinitionwithreturnas an operand of||. (@Starlexxx) - #16014: Fix an incorrect autocorrect for
Style/ReturnNilInPredicateMethodDefinitionwithreturnin a ternary branch. (@bbatsov) - #15877: Fix an incorrect autocorrect for
Style/ReturnNilwith an operandreturn. (@koic) - #15842: Fix an incorrect autocorrect for
Style/SingleLineMethodswithStyle/EndlessMethodwhen the method body is anand/oroperation, a multiple assignment or an assignment of a command call. (@bbatsov) - #15916: Fix an incorrect autocorrect for
Style/SingleLineMethodswith unparenthesized parameters. (@koic) - #15737: Fix an incorrect autocorrect for
Style/StabbyLambdaParentheseswhen usingEnforcedStyle: require_no_parenthesesand a lambda argument has a default value containing a brace, such as->(x = {}). (@viralpraxis) - #15744: Fix an incorrect autocorrect for
Style/StabbyLambdaParentheseswhen usingEnforcedStyle: require_no_parenthesesand a line break or comment separates the parentheses from the arguments. (@viralpraxis) - #15899: Fix an incorrect autocorrect for
Style/StringConcatenationwith quotes in an interpolated percent literal. (@Starlexxx) - #15999: Fix an incorrect autocorrect for
Style/SymbolProcwith a lambda literal in a pattern. (@bbatsov) - #15839: Fix an incorrect autocorrect for
Style/TernaryParentheseswith a condition binding looser than?:. (@bbatsov) - #15838: Fix an incorrect autocorrect for
Style/TrailingUnderscoreVariablewith a nested group of underscores or a bracketless list of values. (@bbatsov) - #15840: Fix an incorrect autocorrect for
Style/WhileUntilModifierwith abeginblock body. (@bbatsov) - #15883: Fix an incorrect autocorrect for
Style/YodaExpressionwith a splat argument. (@koic) - #15754: Fix an infinite loop between
Layout/EmptyLinesAroundBlockBody,Layout/EmptyLinesAroundClassBodyorLayout/EmptyLinesAroundModuleBodywithEnforcedStyle: empty_linesand a cop indenting the sameend, such asLayout/BlockAlignmentorLayout/EndAlignment. (@viralpraxis) - #15845: Fix an infinite loop for
Layout/BlockAlignmentwithLayout/IndentationStyleenforcing tabs whenendis already indented like the line the block starts on. (@viralpraxis) - #15792: Fix an infinite loop for
Layout/BlockAlignmentwithLayout/IndentationStyleenforcing tabs. (@koic) - #15778: Fix an infinite loop for
Layout/CaseIndentationwithLayout/IndentationStyleenforcing tabs. (@viralpraxis) - #15837: Fix an infinite loop for
Layout/DefEndAlignmentwith a single-linedefafter a line continuation. (@bbatsov) - #15910: Fix an infinite loop for
Layout/EmptyLineAfterMultilineConditionwith a modifierwhile. (@koic) - #15985: Fix an infinite loop for
Layout/EmptyLineAfterMultilineConditionwith a body on the condition line. (@koic) - #15892: Fix an infinite loop for
Layout/EmptyLinesAroundAttributeAccessorwith code on the same line. (@koic) - #15814: Fix an infinite loop for
Layout/EmptyLinesAroundExceptionHandlingKeywordswith an empty clause. (@koic) - #15820: Fix an infinite loop for
Layout/EndAlignmentwithEnforcedStyleAlignWith: variable. (@koic) - #15759: Fix an infinite loop for
Layout/ExtraSpacingwith an assignment behind a comparison. (@koic) - #15980: Fix an infinite loop for
Layout/FirstArgumentIndentationwith a method chain beginning its line. (@koic) - #15857: Fix an infinite loop for
Layout/FirstHashElementIndentationwhenLayout/HashAlignmentuses the separator style and a key spans several lines. (@koic) - #15821: Fix an infinite loop for
Layout/HashAlignmentwith a key spanning multiple lines. (@koic) - #15901: Fix an infinite loop for
Layout/HeredocArgumentClosingParenthesiswith a heredoc in a block argument. (@koic) - #15693: Fix an infinite loop for
Layout/IndentationStylewhen usingEnforcedStyle: tabsand a line is aligned with spaces following the indenting tab. (@viralpraxis) - #15958: Fix an infinite loop for
Layout/IndentationWidthwith an inline access modifier andoutdentaccess modifier style. (@Starlexxx) - #15925: Fix an infinite loop for
Layout/LineEndStringConcatenationIndentationwith a long run of misaligned parts. (@Starlexxx) - #15787: Fix an infinite loop for
Layout/LineLengthcop withSplitStrings: truewhen the limit falls right after a string's opening quote. (@Starlexxx) - #15982: Fix an infinite loop for
Layout/LineLengthwith a string starting past the limit. (@koic) - #15791: Fix an infinite loop for
Layout/LineLengthwith a string starting with an interpolation. (@koic) - #15981: Fix an infinite loop for
Layout/RedundantLineBreakwith offenses sharing a line. (@koic) - #15769: Fix an infinite loop for
Layout/RescueEnsureAlignmentwithLayout/IndentationStyleenforcing tabs. (@koic) - #15763: Fix an infinite loop between
Layout/SpaceAroundBlockParameters,Layout/SpaceInsideParensandLayout/ExtraSpacingwhen both cops require a space inside a lambda's parameter parentheses. (@viralpraxis) - #15874: Fix an infinite loop for
Layout/SpaceAroundBlockParameterswith a trailing comma. (@koic) - #15997: Fix an infinite loop for
Layout/SpaceInsideArrayLiteralBracketswithEnforcedStyle: compact. (@bbatsov) - #15719: Fix an infinite loop for
Layout/SpaceInsideBlockBraceswhen usingEnforcedStyle: no_spaceand a multiline block's closing brace is not preceded by a space. (@viralpraxis) - #15722: Fix false positives in
Layout/SpaceInsideBlockBraceswithEnforcedStyle: no_spacewhen a multiline block without block parameters has a line break after the opening brace. (@viralpraxis) - #15983: Fix an infinite loop for
Layout/SpaceInsideBlockBraceswith a comment after the left brace. (@koic) - #15816: Fix an infinite loop for
Layout/SpaceInsideBlockBraceswithLayout/BlockAlignmentwhen a leading-dot chained block has its closing brace on its own line. (@viralpraxis) - #15837: Fix an infinite loop for
Lint/AmbiguousOperatorPrecedencewith an operator method called with a dot. (@bbatsov) - #15880: Fix an infinite loop for
Lint/LiteralInInterpolationwithLayout/SpaceInsideStringInterpolation. (@koic) - #15837: Fix an infinite loop for
Lint/LiteralInInterpolationwith an ideographic space at the end of a heredoc line. (@bbatsov) - #15837: Fix an infinite loop for
Style/EmptyMethodwith a multiline argument. (@bbatsov) - #15738: Fix an infinite loop for
Style/EndlessMethodwhen tab indentation or a trailing comment puts the endless method definition overLayout/LineLength. (@viralpraxis) - #15956: Fix an infinite loop for
Style/EndlessMethodwithLayout/SpaceInsideParensadding spaces to new parentheses. (@Starlexxx) - #15950: Fix an infinite loop for
Style/HashLookupMethodwithStyle/FetchEnvVar. (@koic) - #15894: Fix an infinite loop for
Style/MethodCallWithArgsParentheseswith anonymous rest arguments forwarding. (@koic) - #15755: Fix an infinite loop for
Style/MultilineMethodSignaturewhen a method definition is preceded by other code on the same line, such asprivate def, and joining the signature would exceedLayout/LineLength. (@viralpraxis) - #15884: Fix an infinite loop for
Style/MultilineMethodSignaturewith a multiline parameter. (@koic) - #15723: Fix an infinite loop for
Style/MutableConstantwhen a constant is assigned a method call with arguments and without parentheses. (@viralpraxis) - #15933: Fix an infinite loop for
Style/MutableConstantwithEnforcedStyle: strictand a chained assignment. (@koic) - #15891: Fix an infinite loop for
Style/MutableConstantwithEnforcedStyle: strictand a logical operator. (@koic) - #15885: Fix an infinite loop for
Style/MutableConstantwithEnforcedStyle: strictand a parenthesized value. (@koic) - #15846: Fix an infinite loop for
Style/RedundantBegincop when joining a single statement onto the assignment line would exceedLayout/LineLength. (@Starlexxx) - #15837: Fix an infinite loop for
Style/RedundantParentheseswith a setter in an empty condition. (@bbatsov) - #15872: Fix an infinite loop for
Style/ReturnNilwith a top-levelreturn. (@Starlexxx) - #15690: Fix
Style/DisableCopsWithinSourceCodeDirectiveto no longer autocorrect by removing a directive that only lacks a--justification whenAllowWithReasonis enabled. (@koic) - #16001: Fix
autocorrect_incompatible_withbeing ignored when the declaring cop runs last. (@bbatsov) - #15935: Fix cop errors not failing a run that inspects files in parallel. (@bbatsov)
- #15784: Fix
rubocop:enable-next,rubocop:pushandrubocop:nextdirectives not running cops disabled in the configuration when given a department name. (@bbatsov) - #16009: Fix the documentation URL of cops with digits in their names, such as
Lint/UselessRuby2Keywords, which dropped the digits from the anchor. (@bbatsov) - #15786: Fix an incorrect autocorrect for
Lint/MisplacedMagicCommentwhen a misplacedencodingcomment overrode an effective one. (@bbatsov) - #15945: Fix MCP autocorrection rewriting files it has nothing to correct in. (@bbatsov)
- #15937: Fix the ignored
--parallelnotice being shown for--no-parallel. (@bbatsov) - #15908: Fix false negatives for
Layout/EmptyLineswith CRLF line endings. (@koic) - #15771: Fix false negatives for
Style/AmbiguousEndlessMethodDefinitioncop with singleton methods. (@Starlexxx) - #15836: Fix false negatives in
Style/SelfAssignmentwith a parenthesized right-hand side. (@koic) - #15761: Fix false positive for
Layout/MultilineMethodCallIndentationwhen a method chain is inside a block,begin,ifor loop body in a hash pair value. (@amritk) - #14520: Fix false positives for
Lint/UselessAssignmentwhen a loop condition variable is reassigned in a loop body inside a method. (@mattyb) - #15803: Fix false positives for
Lint/UselessAssignmentwhen a variable reassigned in a conditional inbeginis referenced inrescue. (@mattyb) - #15822: Fix false positives in
Layout/CaseIndentationwhen usingIndentOneStep: truewith tab indentation. (@koic) - #15828: Fix false positives in
Layout/SpaceAfterNotwhen the argument is a unary~. (@koic) - #15829: Fix false positives in
Style/DoubleNegationwhen using three or more negations. (@koic) - #15783: Fix
--changedmissing untracked files outside the current directory when run from a subdirectory. (@bbatsov) - #15838: Fix incorrect autocorrects for
Lint/LiteralAsConditionwith anifused as a value or a post-loop containingbreak,nextorredo. (@bbatsov) - #15779: Fix
--diffwriting the corrected file to disk, and leaving the removal out of the patch, when the file has a redundantrubocop:disable. (@bbatsov) - #15363: Fix
Lint/RedundantCopDisableDirectivereporting directives for cops that only the preview defaults disable, which are needed again once preview is off. (@bbatsov) - #15959: Fix MCP autocorrection leaving a file truncated when the disk fills up while it is being written. (@bbatsov)
- #15786: Fix an incorrect autocorrect for
Lint/MisplacedMagicCommentthat pushed an effectiveencodingcomment off the first line when moving afrozen_string_literalcomment. (@bbatsov) - #15751: Fix an infinite loop when autocorrecting
Layout/HashAlignmentwithEnforcedHashRocketStyle: separatortogether withLayout/SpaceAroundOperatorsby aligning values one space after the separator instead of copying the first pair's value spacing. (@Starlexxx) - #15717: Fix an infinite loop when autocorrecting
Layout/HashAlignmentwithEnforcedHashRocketStyle: separatortogether withLayout/SpaceAroundOperatorsby skipping offenses for keys that are too wide to right-align with the first key. (@Starlexxx) - #15692: Fix
Parser::ClobberingErrorforLayout/RedundantLineBreakwhen autocorrecting nested assignments with a multiline right-hand side. (@Starlexxx) - #15713: Fix an infinite loop when autocorrecting
Layout/SpaceAroundKeywordtogether withLayout/SpaceBeforeBlockBraceswithEnforcedStyle: no_spacefor a keyword followed by a brace block. (@Starlexxx) - #15948: Fix the LSP server applying contextual corrections while editing for the rest of a session after a cop fails during a format command. (@bbatsov)
- #15923: Fix MCP requests failing outright when a cop crashes. (@bbatsov)
- #15945: Fix offenses that autocorrection leaves being reported twice when it removes a redundant directive. (@bbatsov)
- #15711: Fix pending cops being dropped when two departments share a cop name. (@bquorning)
- #15131: Fix false negatives for unparenthesized bitwise operations and prevent conflicting
Style/NumericPredicateautocorrections. (@saidM) - #9325: Fix preview not merging an inherited
ExcludewhenAllCops: Previewcomes after the cop in an inherited file, or from an earlier file ininherit_from. (@bbatsov) - #15363: Fix
AllCops: Previewbeing ignored, and--previewleaking into the default configuration, when an extension injects defaults viaConfigLoader.inject_defaults!or a plugin is loaded. (@bbatsov) - #15937: Fix the notice that
--parallelis being ignored going to stdout, where it broke--format jsonoutput. (@bbatsov) - #15959: Fix MCP tools answering an argument they don't take with an internal error rather than a tool error that names it. (@bbatsov)
- #15363: Fix an invalid
AllCops: Previewvalue being silently treated asfalseinstead of rejected. (@bbatsov) - #15957: Fix the MCP server reporting length and complexity offenses on a definition's first line only, and syntax errors without the parser version, unlike
--format json. (@bbatsov) - #15782: Fix the SARIF formatter reporting
noteas the default level ofSecuritycops, whose results are reported aswarning. (@bbatsov) - #15783: Fix
--changedskipping staged files in a repository without any commits. (@bbatsov) - #15782: Fix the SARIF formatter giving repeated offenses of a cop on identical line text the same fingerprint, which let GitHub code scanning merge them into one alert. (@bbatsov)
- #15782: Fix
--format sarifoutput being followed by the diff under--diffor the corrected source under--stdin --autocorrect, which made it invalid JSON. (@bbatsov) - #15720: Fix
rubocop -aleaving the file empty when interrupted while writing the corrected source, by writing to a temporary file in the same directory and renaming it over the original. (@koic) - #15959: Fix the MCP server's setup advice limiting the
mcpgem to versions below 1.0. (@bbatsov) - #15784: Fix
Style/DisableCopsWithinSourceCodeDirectiveignoring the obsoleteAllowTrailingCommentsetting instead of treating it asAllowWithReason. (@bbatsov) - #15784: Fix
Style/DisableCopsWithinSourceCodeDirectiveignoringAllowedCopsforrubocop:push/rubocop:nextarguments and leaving an orphanrubocop:popwhen correcting arubocop:push. (@bbatsov) - #16007: Fix
Style/ExactRegexpMatchtreatingstring === regexpas a regexp match. (@bbatsov) - #15741: Fix an incorrect autocorrect for
Style/MethodCallWithArgsParentheseswithEnforcedStyle: require_parentheseswhen the argument is a grouped expression containing a keyword operator, modifier, or multiple statements. (@Starlexxx) - #15712: Fix an infinite loop when autocorrecting
Style/MissingElsetogether withStyle/GuardClausewhen the conditional branch is a guard clause. (@Starlexxx) - #15995: Fix
Style/Semicolondropping arguments and erroring onyield/superwith hash value omission. (@bbatsov) - #15783: Fix
--changed libfailing with an error instead of inspecting the changed files underlib. (@bbatsov) - #16001: Fix the obsolete config message for a removed cop without alternatives. (@bbatsov)
- #16012: Fix the
offensesandworstformatters printing "Total in 1 files". (@bbatsov)
Changes
- #16010: Load
net/httponly when a remote config is fetched, instead of on every run. (@bbatsov) - #15732: Check
requires_gemrequirements againsttarget_gem_version, so that an extension can honor its own target version setting underAllCops, likeTargetRailsVersion, by overriding it. (@koic) - #15843: Mark
Style/NegativeArrayIndexas unsafe. (@bbatsov) - #15896: Report offenses from the MCP server's
rubocop_inspectiontool in the--format jsonshape instead of as LSP diagnostics, with inline code results in the same files-and-summary form as file results. (@bbatsov) - #15701: Make
--show-copsand--show-docs-urlreport unrecognized cop names and exit non-zero, instead of silently ignoring them. (@bbatsov)