gems rubocop 1.92.0
RuboCop v1.92.0

3 hours ago

New features

  • #15895: Add an MCP tool that explains what cops do. (@bbatsov)
  • #15700: Add --explain COP to describe what a cop does, how it is configured, and the examples from its documentation. (@bbatsov)
  • #15699: Add --max-offenses-per-cop to cap how many offenses a single cop reports. (@bbatsov)
  • #15948: Let MCP autocorrection apply the corrections of AutoCorrect: contextual cops 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/UselessAssignment register 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/MissingCopEnableDirective when an enable-next or next +Cop directive suspends an open rubocop:disable, and a false positive for next -Cop scopes larger than MaxRangeSize. (@bbatsov)
  • #16005: Fix a false negative for Security/JSONLoad with create_additions as the second argument. (@bbatsov)
  • #15994: Fix a false positive for Layout/LineEndStringConcatenationIndentation with an already aligned part. (@bbatsov)
  • #15842: Fix a false positive for Style/ExplicitBlockArgument when the method uses argument forwarding (...). (@bbatsov)
  • #15843: Fix a false positive for Style/NegativeArrayIndex with a different length receiver. (@bbatsov)
  • #15841: Fix a false positive for Style/RedundantFreeze with an arithmetic operation on a non-numeric receiver. (@bbatsov)
  • #15843: Fix a false positive for Style/Sample with an endless range, which was corrected to a sample call of the wrong size. (@bbatsov)
  • #15842: Fix a false positive for Style/SuperArguments when the method has a destructuring parameter. (@bbatsov)
  • #15740: Fix an error for Layout/EmptyLinesAroundMethodBody when a method's arguments span multiple lines and the method ends on the last argument's line. (@viralpraxis)
  • #15860: Fix an error for Layout/HeredocIndentation with a heredoc nested in another heredoc. (@Starlexxx)
  • #15876: Fix an error for Lint/EmptyConditionalBody with else on the condition line. (@koic)
  • #16008: Fix an error for Lint/UnescapedBracketInRegexp when using regexp_parser 2.11.2 and earlier. (@bbatsov)
  • #15897: Fix an error for Metrics/ClassLength with a long singleton class in LSP mode. (@bbatsov)
  • #15749: Fix an error for Style/ClassAndModuleChildren when 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/ClassAndModuleChildren when using EnforcedStyle: compact and the nested body is indented less than Layout/IndentationWidth's Width. (@viralpraxis)
  • #15764: Fix an error for Style/ClassAndModuleChildren when EnforcedStyle: compact compacts an irregularly indented definition and Layout/IndentationStyle enforces tabs. (@viralpraxis)
  • #15946: Fix an error for Style/ExplicitBlockArgument with the shorthand call syntax. (@Starlexxx)
  • #15861: Fix an error for Style/FormatString with format nested in format. (@Starlexxx)
  • #15694: Fix an error for Style/HashSyntax when a no_mixed_keys style forces hash rockets on a hash whose value repeats its key. (@viralpraxis)
  • #16007: Fix an error for Style/IfInsideElse when the nested if shares a line with other code. (@bbatsov)
  • #15867: Fix an error for Style/MapIntoArray when pushing into a numbered or it block parameter. (@Starlexxx)
  • #15949: Fix an error for Style/Next with a modifier condition wrapping a block that has its own offense. (@Starlexxx)
  • #15797: Fix an error for Style/RedundantCondition when autocorrecting a redundant condition nested in the else branch of another one. (@koic)
  • #15928: Fix an error for Style/Semicolon when a semicolon follows an unparenthesized keyword parameter or hash pattern. (@viralpraxis)
  • #15714: Fix an error for Style/YodaCondition when one operand of a comparison contains another comparison the cop also corrects. (@viralpraxis)
  • #16011: Fix an error for the pacman formatter, which crashed with undefined 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/OrderedDependencies when the same dependency declaration appears more than once in the gemspec. (@viralpraxis)
  • #15903: Fix an incorrect autocorrect for Layout/ClassStructure with blank line cops. (@koic)
  • #15984: Fix an incorrect autocorrect for Layout/ClassStructure with Layout/EmptyLinesAroundAccessModifier. (@koic)
  • #15997: Fix an incorrect autocorrect for Layout/ClassStructure with a heredoc constant. (@bbatsov)
  • #15697: Fix an incorrect autocorrect for Layout/EmptyLinesAroundBlockBody when using EnforcedStyle: empty_lines and the empty line would precede a leading dot method call. (@viralpraxis)
  • #15953: Fix an incorrect autocorrect for Layout/EmptyLinesAroundBlockBody with do on its own line. (@koic)
  • #15818: Fix an incorrect autocorrect for Layout/ExtraSpacing cop with ForceEqualSignAlignment: true when Style/SelfAssignment rewrites the same assignment. (@Starlexxx)
  • #15997: Fix an incorrect autocorrect for Layout/FirstArgumentIndentation with an inner call not beginning its line. (@bbatsov)
  • #15904: Fix an incorrect autocorrect for Layout/FirstMethodArgumentLineBreak with Style/MethodCallWithArgsParentheses. (@koic)
  • #15875: Fix an incorrect autocorrect for Layout/FirstMethodParameterLineBreak with Style/MethodDefParentheses. (@koic)
  • #15793: Fix an incorrect autocorrect for Layout/LineContinuationSpacing cop when a line ends with the $\ global variable. (@Starlexxx)
  • #15656: Fix an incorrect autocorrect for Layout/LineLength when breaking a line after an argument with a nested heredoc. (@Starlexxx)
  • #15844: Fix an incorrect autocorrect for Layout/LineLength cop when Style/MethodCallWithArgsParentheses with EnforcedStyle: omit_parentheses removes the parentheses it breaks after. (@Starlexxx)
  • #15813: Fix an incorrect autocorrect for Layout/LineLength when SplitStrings: true would split a string inside an escape sequence such as \000. (@koic)
  • #15777: Fix an incorrect autocorrect for Layout/LineLength with SplitStrings: true when an interpolation in the string contains a block. (@Starlexxx)
  • #15997: Fix an incorrect autocorrect for Layout/LineLength with SplitStrings and a string not beginning its line. (@bbatsov)
  • #15964: Fix an incorrect autocorrect for Layout/MultilineArrayBraceLayout with Layout/MultilineHashBraceLayout and Layout/MultilineMethodCallBraceLayout. (@koic)
  • #15966: Fix an incorrect autocorrect for Layout/MultilineArrayBraceLayout with Style/ConcatArrayLiterals. (@koic)
  • #15789: Fix an incorrect autocorrect for Layout/MultilineBlockLayout cop adding a trailing comma when the only positional block argument is followed by keyword arguments. (@Starlexxx)
  • #15955: Fix an incorrect autocorrect for Layout/MultilineBlockLayout with block argument rewriting cops. (@koic)
  • #15932: Fix an incorrect autocorrect for Layout/MultilineHashBraceLayout with Style/HashAsLastArrayItem and Style/RedundantDoubleSplatHashBraces. (@koic)
  • #15906: Fix an incorrect autocorrect for Layout/MultilineArrayLineBreaks, Layout/MultilineHashKeyLineBreaks, Layout/MultilineMethodArgumentLineBreaks and Layout/MultilineMethodParameterLineBreaks after a heredoc opener. (@koic)
  • #15748: Fix an incorrect autocorrect for Layout/MultilineMethodCallBraceLayout when EnforcedStyle: omit_parentheses of Style/MethodCallWithArgsParentheses removes the parentheses the layout cop is moving. (@koic)
  • #15870: Fix an incorrect autocorrect for Layout/MultilineMethodDefinitionBraceLayout with Style/MultilineMethodSignature. (@Starlexxx)
  • #15967: Fix an incorrect autocorrect for Layout/SingleLineBlockChain with Style/NilComparison. (@koic)
  • #15988: Fix an incorrect autocorrect for Layout/SingleLineBlockChain with Style/FloatDivision. (@koic)
  • #15865: Fix an incorrect autocorrect for Layout/SingleLineBlockChain with a heredoc. (@Starlexxx)
  • #15735: Fix an incorrect autocorrect for Layout/SpaceInsideBlockBraces with EnforcedStyle: no_space when a multiline block's last line has code before the closing bracket. (@viralpraxis)
  • #15838: Fix an incorrect autocorrect for Lint/AmbiguousOperator with Style/ArgumentsForwarding. (@bbatsov)
  • #15913: Fix an incorrect autocorrect for Lint/EmptyConditionalBody with an empty elsif and else. (@koic)
  • #15971: Fix an incorrect autocorrect for Lint/LiteralInInterpolation with a # next to the interpolation. (@koic)
  • #15999: Fix an incorrect autocorrect for Lint/LiteralInInterpolation with an empty literal after a #. (@bbatsov)
  • #16004: Fix an incorrect autocorrect for Lint/LiteralInInterpolation with two adjacent interpolations. (@bbatsov)
  • #15795: Fix an incorrect autocorrect for Lint/Loop when begin ... end while or begin ... end until is written on a single line. (@koic)
  • #15889: Fix an incorrect autocorrect for Lint/NumberConversion with a symbol operand of an operator. (@koic)
  • #15934: Fix an incorrect autocorrect for Lint/RedundantDirGlobSort with a leading dot. (@koic)
  • #16007: Fix an incorrect autocorrect for Lint/UnescapedBracketInRegexp with a double-quoted Regexp.new string. (@bbatsov)
  • #16007: Fix an incorrect autocorrect for Lint/UnescapedBracketInRegexp with an escaped Regexp.new string. (@bbatsov)
  • #15838: Fix an incorrect autocorrect for Lint/UselessAssignment with a list of values without brackets. (@bbatsov)
  • #15796: Fix an incorrect autocorrect for Lint/Void when 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, and Layout/MultilineMethodDefinitionBraceLayout when a heredoc is opened on the line of the closing brace. (@koic)
  • #15952: Fix an incorrect autocorrect for Naming/HeredocDelimiterCase when the body has the corrected delimiter. (@koic)
  • #15800: Fix an incorrect autocorrect for Style/AccessModifierDeclarations with a splatted variable. (@koic)
  • #15801: Fix an incorrect autocorrect for Style/Alias when a symbol argument such as :"foo bar" or :@type has no bareword form. (@koic)
  • #15991: Fix an incorrect autocorrect for Style/AndOr with Style/ReturnNilInPredicateMethodDefinition. (@Starlexxx)
  • #15962: Fix an incorrect autocorrect for Style/ArgumentsForwarding adding parentheses twice to a method definition. (@Starlexxx)
  • #15893: Fix an incorrect autocorrect for Style/ArgumentsForwarding with a block literal. (@koic)
  • #15843: Fix an incorrect autocorrect for Style/Attr with parenthesized arguments. (@bbatsov)
  • #15727: Fix an incorrect autocorrect for Style/BlockDelimiters when a braces block is the collection of a for loop. (@viralpraxis)
  • #15758: Fix an incorrect autocorrect for Style/BlockDelimiters when Style/MethodCallWithArgsParentheses with EnforcedStyle: omit_parentheses removes the call's parentheses in the same pass, producing invalid code such as foo :bar { baz }. (@viralpraxis)
  • #15838: Fix an incorrect autocorrect for Style/BlockDelimiters with a block in a loop condition. (@bbatsov)
  • #15842: Fix an incorrect autocorrect for Style/BlockDelimiters with a multiline block in an argument of yield or super without parentheses. (@bbatsov)
  • #15975: Fix an incorrect autocorrect for Style/BlockDelimiters with a heredoc after rescue. (@koic)
  • #15747: Fix an incorrect autocorrect for Style/BlockDelimiters with Layout/SpaceBeforeBlockBraces. (@koic)
  • #15840: Fix an incorrect autocorrect for Style/CaseLikeIf with an if inside the else branch. (@bbatsov)
  • #15730: Fix an incorrect autocorrect for Style/ClassAndModuleChildren with EnforcedStyle: compact when a one-liner child class has a superclass or a body. (@viralpraxis)
  • #15961: Fix an incorrect autocorrect for Style/ClassAndModuleChildren when compacting a nested definition. (@Starlexxx)
  • #15943: Fix an incorrect autocorrect for Style/ClassAndModuleChildren with Style/StructInheritance. (@koic)
  • #15744: Fix an incorrect autocorrect for Style/ClassMethodsDefinitions when a method definition inside class << self is followed by other code on its last line. (@viralpraxis)
  • #15922: Fix an incorrect autocorrect for Style/CombinableLoops when followed by another block. (@Starlexxx)
  • #15996: Fix an incorrect autocorrect for Style/CombinableLoops when one of the loops is disabled. (@bbatsov)
  • #16006: Fix an incorrect autocorrect for Style/CombinableLoops with comments after the loop's opening. (@bbatsov)
  • #16006: Fix an incorrect autocorrect for Style/CombinableLoops with comments before the closing delimiter. (@bbatsov)
  • #15987: Fix an incorrect autocorrect for Style/CombinableLoops with mixed block delimiters. (@koic)
  • #15996: Fix an incorrect autocorrect for Style/CombinableLoops with numbered and it parameters. (@bbatsov)
  • #15878: Fix an incorrect autocorrect for Style/CombinableLoops with rescue in a loop body. (@koic)
  • #16004: Fix an incorrect autocorrect for Style/ConcatArrayLiterals dropping comments. (@bbatsov)
  • #15834: Fix an incorrect autocorrect for Style/ConcatArrayLiterals with Style/MethodCallWithArgsParentheses. (@koic)
  • #15881: Fix an incorrect autocorrect for Style/ConcatArrayLiterals with Style/TrailingCommaInArguments. (@koic)
  • #15999: Fix an incorrect autocorrect for Style/ConcatArrayLiterals with multiline array arguments. (@bbatsov)
  • #15773: Fix an incorrect autocorrect for Style/ConditionalAssignment with EnforcedStyle: assign_inside_condition when Style/MethodCallWithArgsParentheses with EnforcedStyle: omit_parentheses removes a branch body's parentheses in the same pass, producing invalid code such as foo << bar :baz. (@viralpraxis)
  • #15863: Fix an incorrect autocorrect for Style/EmptyLiteral when Hash[] or Hash([]) is the first argument of a method call without parentheses. (@kevin9327)
  • #15689: Fix an incorrect autocorrect for Style/EndlessMethod when a method is made endless while Style/MethodCallWithArgsParentheses omits parentheses in its body. (@viralpraxis)
  • #16014: Fix an incorrect autocorrect for Style/EndlessMethod and Style/SingleLineMethods with a one-line pattern match or begin...end while body. (@bbatsov)
  • #15715: Fix an incorrect autocorrect for Style/EndlessMethod when the method body ends with an anonymous argument forwarding. (@viralpraxis)
  • #15710: Fix an incorrect autocorrect for Style/EndlessMethod when the method body passes a multiline or xstring heredoc to a method call. (@viralpraxis)
  • #15716: Fix an incorrect autocorrect for Style/EndlessMethod when the method body is a multiple assignment. (@viralpraxis)
  • #15707: Fix an incorrect autocorrect for Style/EndlessMethod when the method body ends with an omitted hash value. (@viralpraxis)
  • #15831: Fix an incorrect autocorrect for Style/EndlessMethod with a command that an endless body cannot hold. (@koic)
  • #15815: Fix an incorrect autocorrect for Style/EndlessMethod deleting a comment placed between the method signature and end. (@koic)
  • #15992: Fix an incorrect autocorrect for Style/EndlessMethod with a modifier condition or and/or body. (@Starlexxx)
  • #15775: Fix an incorrect autocorrect for Style/EndlessMethod when Naming/BlockForwarding or Style/ArgumentsForwarding adds parentheses to the same method definition. (@Starlexxx)
  • #15842: Fix an incorrect autocorrect for Style/EndlessMethod and Style/SingleLineMethods when the method body assigns multiple values without brackets. (@bbatsov)
  • #15756: Fix an incorrect autocorrect for Style/EndlessMethod when the method parameters are not surrounded by parentheses. (@koic)
  • #15843: Fix an incorrect autocorrect for Style/ExactRegexpMatch when the result is used. (@bbatsov)
  • #15790: Fix an incorrect autocorrect for Style/ExplicitBlockArgument cop when the method already has an argument or local variable named block. (@Starlexxx)
  • #15963: Fix an incorrect autocorrect for Style/ExplicitBlockArgument with Style/LambdaCall. (@koic)
  • #15965: Fix an incorrect autocorrect for Style/ExplicitBlockArgument with Style/TrailingCommaInArguments. (@koic)
  • #15998: Fix an incorrect autocorrect for Style/ExplicitBlockArgument with an empty index call. (@bbatsov)
  • #15842: Fix an incorrect autocorrect for Style/ExplicitBlockArgument when super without arguments is called in a method with keyword or block parameters. (@bbatsov)
  • #15977: Fix an incorrect autocorrect for Style/FloatDivision with a leading dot. (@koic)
  • #15768: Fix an incorrect autocorrect for Style/For when EnforcedStyle: for and the block body abuts a brace, such as c.each {d}, which left do or end glued to the body. (@viralpraxis)
  • #15765: Fix an incorrect autocorrect for Style/For when EnforcedStyle: for and the multiline each block is delimited by braces. (@viralpraxis)
  • #15911: Fix an incorrect autocorrect for Style/For with a do...end block in the collection. (@koic)
  • #15838: Fix an incorrect autocorrect for Style/For with a non-local loop variable or an implicit block parameter. (@bbatsov)
  • #15882: Fix an incorrect autocorrect for Style/For with Style/RedundantBegin. (@koic)
  • #15970: Fix an incorrect autocorrect for Style/FormatString with a braced hash argument. (@koic)
  • #15842: Fix an incorrect autocorrect for Style/FormatString when the argument of String#% is an instance variable, a constant or another value that may be an array. (@bbatsov)
  • #15799: Fix an incorrect autocorrect for Style/FrozenStringLiteralComment when 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/GuardClause with an if as the body of an endless method. (@bbatsov)
  • #15998: Fix an incorrect autocorrect for Style/HashConversion in an index, setter or operator call. (@bbatsov)
  • #15998: Fix an incorrect autocorrect for Style/HashConversion when calling a method on Hash[]. (@bbatsov)
  • #15973: Fix an incorrect autocorrect for Style/HashConversion with Style/MethodCallWithArgsParentheses. (@koic)
  • #15998: Fix an incorrect autocorrect for Style/HashConversion with a method chain argument. (@bbatsov)
  • #15998: Fix an incorrect autocorrect for Style/HashConversion with safe navigation, super or yield. (@bbatsov)
  • #15698: Fix an incorrect autocorrect for Style/HashLookupMethod when the lookup is the target of a compound assignment. (@viralpraxis)
  • #15951: Fix an incorrect autocorrect for Style/HashLookupMethod with a leading dot. (@koic)
  • #15944: Fix an incorrect autocorrect for Style/HashLookupMethod with an explicit element reference call. (@koic)
  • #15772: Fix an incorrect autocorrect for Style/HashSyntax with EnforcedStyle: hash_rockets where expanding an omitted hash value also removed the line break that followed it. (@viralpraxis)
  • #15862: Fix an incorrect autocorrect for Style/HashSyntax with Style/MethodCallWithArgsParentheses. (@Starlexxx)
  • #15972: Fix an incorrect autocorrect for Style/HashSyntax with Style/SuperWithArgsParentheses. (@koic)
  • #15879: Fix an incorrect autocorrect for Style/HashSyntax with a keyword-named shorthand value. (@koic)
  • #15869: Fix an incorrect autocorrect for Style/IdenticalConditionalBranches when a duplicated expression shares its line. (@koic)
  • #16007: Fix an incorrect autocorrect for Style/IfInsideElse with a modifier if on the else line. (@bbatsov)
  • #15840: Fix an incorrect autocorrect for Style/IfUnlessModifierOfIfUnless with Style/SoleNestedConditional. (@bbatsov)
  • #16000: Fix an incorrect autocorrect for Style/IfUnlessModifier with a heredoc inside another heredoc. (@bbatsov)
  • #15979: Fix an incorrect autocorrect for Style/IfUnlessModifier with a heredoc nested in the body. (@koic)
  • #15840: Fix an incorrect autocorrect for Style/IfUnlessModifier and Style/WhileUntilModifier with a conditional or loop in a call argument, ternary branch or endless method body. (@bbatsov)
  • #15907: Fix an incorrect autocorrect for Style/IfUnlessModifier with an omitted hash value in a return or an assignment. (@koic)
  • #15852: Fix an incorrect autocorrect for Style/IfWithSemicolon when if is the receiver of a method call or an operand of an operator. (@koic)
  • #15854: Fix an incorrect autocorrect for Style/IfWithSemicolon when a branch is a begin/end loop with a while or until modifier. (@koic)
  • #15850: Fix an incorrect autocorrect for Style/IfWithSemicolon when ! is applied to a method call with unparenthesized arguments. (@koic)
  • #15839: Fix an incorrect autocorrect for Style/IfWithSemicolon when the condition or a branch binds looser than the ternary operator. (@bbatsov)
  • #15941: Fix an incorrect autocorrect for Style/InverseMethods with an operand of an operator. (@koic)
  • #15708: Fix an incorrect autocorrect for Style/ItBlockParameter when using EnforcedStyle: always and the block parameter is used inside a nested block. (@viralpraxis)
  • #15954: Fix an incorrect autocorrect for Style/ItBlockParameter with Style/StabbyLambdaParentheses. (@koic)
  • #15859: Fix an incorrect autocorrect for Style/ItBlockParameter with Style/Lambda. (@Starlexxx)
  • #15912: Fix an incorrect autocorrect for Style/KeywordParametersOrder with trailing whitespace. (@koic)
  • #15718: Fix an incorrect autocorrect for Style/Lambda when a lambda literal has an argument whose default value needs parentheses between pipes. (@viralpraxis)
  • #15986: Fix an incorrect autocorrect for Style/LambdaCall with a heredoc argument. (@Starlexxx)
  • #15978: Fix an incorrect autocorrect for Style/Lambda with a lambda literal in a pattern. (@koic)
  • #15887: Fix an incorrect autocorrect for Style/Lambda with rescue in an unparenthesized argument. (@koic)
  • #15826: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses when Style/TernaryParentheses also parenthesizes the arguments of a ternary condition. (@koic)
  • #15812: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with EnforcedStyle: omit_parentheses when Style/AndOr rewrites the and/or keyword around an argument-bearing call in the same pass. (@koic)
  • #15833: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses when Style/RedundantParentheses removes the parentheses around a call whose own parentheses are omitted in the same pass. (@koic)
  • #15824: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with EnforcedStyle: omit_parentheses when a call is assigned before the and or or keyword. (@koic)
  • #15905: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with a closing parenthesis on its own line. (@koic)
  • #15974: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with a nested call at the end of the line. (@koic)
  • #15999: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with a comment after (. (@bbatsov)
  • #4524: Fix an incorrect autocorrect for Style/MethodCallWithoutArgsParentheses when a local variable has the same name. (@bbatsov)
  • #15696: Fix an incorrect autocorrect for Style/MethodDefParentheses when using EnforcedStyle: require_no_parentheses and the parameters begin on a line below the method name. (@viralpraxis)
  • #15888: Fix an incorrect autocorrect for Style/MethodDefParentheses with a destructured first parameter. (@koic)
  • #15914: Fix an incorrect autocorrect for Style/MethodDefParentheses with a single-line method body. (@koic)
  • #16000: Fix an incorrect autocorrect for Style/MultilineIfModifier with a heredoc opened on the modifier line. (@bbatsov)
  • #16006: Fix an incorrect autocorrect for Style/MultilineIfModifier with a multiline string in the body. (@bbatsov)
  • #16006: Fix an incorrect autocorrect for Style/MultilineIfModifier with a non-squiggly heredoc in the body. (@bbatsov)
  • #15969: Fix an incorrect autocorrect for Style/MultilineInPatternThen with an endless range pattern. (@Starlexxx)
  • #15848: Fix an incorrect autocorrect for Style/MultilineTernaryOperator with defined? without parentheses. (@koic)
  • #15839: Fix an incorrect autocorrect for Style/MultilineTernaryOperator with yield and super. (@bbatsov)
  • #15969: Fix an incorrect autocorrect for Style/MultilineWhenThen with an endless range condition. (@Starlexxx)
  • #15902: Fix an incorrect autocorrect for Style/MutableConstant with Recursive: true and trailing comma cops. (@koic)
  • #15840: Fix an incorrect autocorrect for Style/NegatedIfElseCondition with then or a semicolon after the condition. (@bbatsov)
  • #15840: Fix an incorrect autocorrect for Style/NestedModifier with low-precedence operands. (@bbatsov)
  • #15839: Fix an incorrect autocorrect for Style/NestedTernaryOperator when the ternary follows return or is a command argument, or when the if branch has parentheses that do not wrap all of it. (@bbatsov)
  • #15864: Fix an incorrect autocorrect for Style/NestedTernaryOperator with a heredoc. (@Starlexxx)
  • #15847: Fix an incorrect autocorrect for Style/NestedTernaryOperator when the ternary is the operand of not or defined? without parentheses. (@koic)
  • #15841: Fix an incorrect autocorrect for Style/Next with heredocs and multiline string literals. (@bbatsov)
  • #15830: Fix an incorrect autocorrect for Style/NilComparison when a method is called on nil?. (@koic)
  • #15960: Fix an incorrect autocorrect for Style/NilComparison with a leading dot. (@koic)
  • #15806: Fix an incorrect autocorrect for Style/NonNilCheck when the receiver is a unary operation, such as !a != nil. (@viralpraxis)
  • #15827: Fix an incorrect autocorrect for Style/Not with a unary ~ operand. (@koic)
  • #15807: Fix an incorrect autocorrect for Style/NumericPredicate when the receiver is a unary operation, such as -a < 0. (@viralpraxis)
  • #15886: Fix an incorrect autocorrect for Style/NumericPredicate with EnforcedStyle: comparison in an operand. (@koic)
  • #15849: Fix an incorrect autocorrect for Style/OneLineConditional with a post-condition loop branch. (@koic)
  • #15851: Fix an incorrect autocorrect for Style/OneLineConditional with a constant scope or a ternary condition. (@koic)
  • #15839: Fix an incorrect autocorrect for Style/OneLineConditional when a branch uses a modifier rescue/while/until or a one-line pattern match, or when the conditional is the receiver of a method call. (@bbatsov)
  • #15843: Fix an incorrect autocorrect for Style/PercentLiteralDelimiters with an escaped delimiter. (@bbatsov)
  • #15835: Fix an incorrect autocorrect for Style/ReduceToHash with a key or a value that is not an array element. (@koic)
  • #15841: Fix an incorrect autocorrect for Style/RedundantBegin with low precedence statements and multiline return values. (@bbatsov)
  • #15841: Fix an incorrect autocorrect for Style/RedundantCondition with a low precedence else branch. (@bbatsov)
  • #15841: Fix an incorrect autocorrect for Style/RedundantCondition with operator method branches. (@bbatsov)
  • #15909: Fix an incorrect autocorrect for Style/RedundantDoubleSplatHashBraces with Style/TrailingCommaInHashLiteral. (@koic)
  • #15841: Fix an incorrect autocorrect for Style/RedundantException with a compound message. (@bbatsov)
  • #15663: Fix an incorrect autocorrect for Style/RedundantFetchBlock when fetch is called with a splat, an anonymous rest argument, or keyword arguments. (@ihamzatarar)
  • #15811: Fix an incorrect autocorrect for Style/RedundantParentheses with a heredoc and a chained call. (@koic)
  • #15825: Fix an incorrect autocorrect for Style/RedundantParentheses with a heredoc opened on the closing parenthesis line. (@koic)
  • #15798: Fix an incorrect autocorrect for Style/RedundantRegexpArgument with an escaped #{. (@koic)
  • #15843: Fix an incorrect autocorrect for Style/RedundantRegexpConstructor with an ambiguous slash regexp. (@bbatsov)
  • #15810: Fix an incorrect autocorrect for Style/RedundantRegexpEscape cop when Style/RegexpLiteral changes the delimiters of the same regexp in the same pass. (@Starlexxx)
  • #15819: Fix an incorrect autocorrect for Style/RegexpLiteral when a %r literal whose body starts with a newline is passed to a method without parentheses. (@koic)
  • #15809: Fix an incorrect autocorrect for Style/RegexpLiteral with a slash inside an interpolation. (@koic)
  • #15823: Fix an incorrect autocorrect for Style/RegexpLiteral when a %r literal escapes its own delimiter in the body. (@koic)
  • #15993: Fix an incorrect autocorrect for Style/RequireOrder with a require sharing its line. (@Starlexxx)
  • #15843: Fix an incorrect autocorrect for Style/RescueModifier with a nested heredoc. (@bbatsov)
  • #15991: Fix an incorrect autocorrect for Style/ReturnNilInPredicateMethodDefinition with return as an operand of ||. (@Starlexxx)
  • #16014: Fix an incorrect autocorrect for Style/ReturnNilInPredicateMethodDefinition with return in a ternary branch. (@bbatsov)
  • #15877: Fix an incorrect autocorrect for Style/ReturnNil with an operand return. (@koic)
  • #15842: Fix an incorrect autocorrect for Style/SingleLineMethods with Style/EndlessMethod when the method body is an and/or operation, a multiple assignment or an assignment of a command call. (@bbatsov)
  • #15916: Fix an incorrect autocorrect for Style/SingleLineMethods with unparenthesized parameters. (@koic)
  • #15737: Fix an incorrect autocorrect for Style/StabbyLambdaParentheses when using EnforcedStyle: require_no_parentheses and a lambda argument has a default value containing a brace, such as ->(x = {}). (@viralpraxis)
  • #15744: Fix an incorrect autocorrect for Style/StabbyLambdaParentheses when using EnforcedStyle: require_no_parentheses and a line break or comment separates the parentheses from the arguments. (@viralpraxis)
  • #15899: Fix an incorrect autocorrect for Style/StringConcatenation with quotes in an interpolated percent literal. (@Starlexxx)
  • #15999: Fix an incorrect autocorrect for Style/SymbolProc with a lambda literal in a pattern. (@bbatsov)
  • #15839: Fix an incorrect autocorrect for Style/TernaryParentheses with a condition binding looser than ?:. (@bbatsov)
  • #15838: Fix an incorrect autocorrect for Style/TrailingUnderscoreVariable with a nested group of underscores or a bracketless list of values. (@bbatsov)
  • #15840: Fix an incorrect autocorrect for Style/WhileUntilModifier with a begin block body. (@bbatsov)
  • #15883: Fix an incorrect autocorrect for Style/YodaExpression with a splat argument. (@koic)
  • #15754: Fix an infinite loop between Layout/EmptyLinesAroundBlockBody, Layout/EmptyLinesAroundClassBody or Layout/EmptyLinesAroundModuleBody with EnforcedStyle: empty_lines and a cop indenting the same end, such as Layout/BlockAlignment or Layout/EndAlignment. (@viralpraxis)
  • #15845: Fix an infinite loop for Layout/BlockAlignment with Layout/IndentationStyle enforcing tabs when end is already indented like the line the block starts on. (@viralpraxis)
  • #15792: Fix an infinite loop for Layout/BlockAlignment with Layout/IndentationStyle enforcing tabs. (@koic)
  • #15778: Fix an infinite loop for Layout/CaseIndentation with Layout/IndentationStyle enforcing tabs. (@viralpraxis)
  • #15837: Fix an infinite loop for Layout/DefEndAlignment with a single-line def after a line continuation. (@bbatsov)
  • #15910: Fix an infinite loop for Layout/EmptyLineAfterMultilineCondition with a modifier while. (@koic)
  • #15985: Fix an infinite loop for Layout/EmptyLineAfterMultilineCondition with a body on the condition line. (@koic)
  • #15892: Fix an infinite loop for Layout/EmptyLinesAroundAttributeAccessor with code on the same line. (@koic)
  • #15814: Fix an infinite loop for Layout/EmptyLinesAroundExceptionHandlingKeywords with an empty clause. (@koic)
  • #15820: Fix an infinite loop for Layout/EndAlignment with EnforcedStyleAlignWith: variable. (@koic)
  • #15759: Fix an infinite loop for Layout/ExtraSpacing with an assignment behind a comparison. (@koic)
  • #15980: Fix an infinite loop for Layout/FirstArgumentIndentation with a method chain beginning its line. (@koic)
  • #15857: Fix an infinite loop for Layout/FirstHashElementIndentation when Layout/HashAlignment uses the separator style and a key spans several lines. (@koic)
  • #15821: Fix an infinite loop for Layout/HashAlignment with a key spanning multiple lines. (@koic)
  • #15901: Fix an infinite loop for Layout/HeredocArgumentClosingParenthesis with a heredoc in a block argument. (@koic)
  • #15693: Fix an infinite loop for Layout/IndentationStyle when using EnforcedStyle: tabs and a line is aligned with spaces following the indenting tab. (@viralpraxis)
  • #15958: Fix an infinite loop for Layout/IndentationWidth with an inline access modifier and outdent access modifier style. (@Starlexxx)
  • #15925: Fix an infinite loop for Layout/LineEndStringConcatenationIndentation with a long run of misaligned parts. (@Starlexxx)
  • #15787: Fix an infinite loop for Layout/LineLength cop with SplitStrings: true when the limit falls right after a string's opening quote. (@Starlexxx)
  • #15982: Fix an infinite loop for Layout/LineLength with a string starting past the limit. (@koic)
  • #15791: Fix an infinite loop for Layout/LineLength with a string starting with an interpolation. (@koic)
  • #15981: Fix an infinite loop for Layout/RedundantLineBreak with offenses sharing a line. (@koic)
  • #15769: Fix an infinite loop for Layout/RescueEnsureAlignment with Layout/IndentationStyle enforcing tabs. (@koic)
  • #15763: Fix an infinite loop between Layout/SpaceAroundBlockParameters, Layout/SpaceInsideParens and Layout/ExtraSpacing when both cops require a space inside a lambda's parameter parentheses. (@viralpraxis)
  • #15874: Fix an infinite loop for Layout/SpaceAroundBlockParameters with a trailing comma. (@koic)
  • #15997: Fix an infinite loop for Layout/SpaceInsideArrayLiteralBrackets with EnforcedStyle: compact. (@bbatsov)
  • #15719: Fix an infinite loop for Layout/SpaceInsideBlockBraces when using EnforcedStyle: no_space and a multiline block's closing brace is not preceded by a space. (@viralpraxis)
  • #15722: Fix false positives in Layout/SpaceInsideBlockBraces with EnforcedStyle: no_space when a multiline block without block parameters has a line break after the opening brace. (@viralpraxis)
  • #15983: Fix an infinite loop for Layout/SpaceInsideBlockBraces with a comment after the left brace. (@koic)
  • #15816: Fix an infinite loop for Layout/SpaceInsideBlockBraces with Layout/BlockAlignment when a leading-dot chained block has its closing brace on its own line. (@viralpraxis)
  • #15837: Fix an infinite loop for Lint/AmbiguousOperatorPrecedence with an operator method called with a dot. (@bbatsov)
  • #15880: Fix an infinite loop for Lint/LiteralInInterpolation with Layout/SpaceInsideStringInterpolation. (@koic)
  • #15837: Fix an infinite loop for Lint/LiteralInInterpolation with an ideographic space at the end of a heredoc line. (@bbatsov)
  • #15837: Fix an infinite loop for Style/EmptyMethod with a multiline argument. (@bbatsov)
  • #15738: Fix an infinite loop for Style/EndlessMethod when tab indentation or a trailing comment puts the endless method definition over Layout/LineLength. (@viralpraxis)
  • #15956: Fix an infinite loop for Style/EndlessMethod with Layout/SpaceInsideParens adding spaces to new parentheses. (@Starlexxx)
  • #15950: Fix an infinite loop for Style/HashLookupMethod with Style/FetchEnvVar. (@koic)
  • #15894: Fix an infinite loop for Style/MethodCallWithArgsParentheses with anonymous rest arguments forwarding. (@koic)
  • #15755: Fix an infinite loop for Style/MultilineMethodSignature when a method definition is preceded by other code on the same line, such as private def, and joining the signature would exceed Layout/LineLength. (@viralpraxis)
  • #15884: Fix an infinite loop for Style/MultilineMethodSignature with a multiline parameter. (@koic)
  • #15723: Fix an infinite loop for Style/MutableConstant when a constant is assigned a method call with arguments and without parentheses. (@viralpraxis)
  • #15933: Fix an infinite loop for Style/MutableConstant with EnforcedStyle: strict and a chained assignment. (@koic)
  • #15891: Fix an infinite loop for Style/MutableConstant with EnforcedStyle: strict and a logical operator. (@koic)
  • #15885: Fix an infinite loop for Style/MutableConstant with EnforcedStyle: strict and a parenthesized value. (@koic)
  • #15846: Fix an infinite loop for Style/RedundantBegin cop when joining a single statement onto the assignment line would exceed Layout/LineLength. (@Starlexxx)
  • #15837: Fix an infinite loop for Style/RedundantParentheses with a setter in an empty condition. (@bbatsov)
  • #15872: Fix an infinite loop for Style/ReturnNil with a top-level return. (@Starlexxx)
  • #15690: Fix Style/DisableCopsWithinSourceCodeDirective to no longer autocorrect by removing a directive that only lacks a -- justification when AllowWithReason is enabled. (@koic)
  • #16001: Fix autocorrect_incompatible_with being 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:push and rubocop:next directives 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/MisplacedMagicComment when a misplaced encoding comment overrode an effective one. (@bbatsov)
  • #15945: Fix MCP autocorrection rewriting files it has nothing to correct in. (@bbatsov)
  • #15937: Fix the ignored --parallel notice being shown for --no-parallel. (@bbatsov)
  • #15908: Fix false negatives for Layout/EmptyLines with CRLF line endings. (@koic)
  • #15771: Fix false negatives for Style/AmbiguousEndlessMethodDefinition cop with singleton methods. (@Starlexxx)
  • #15836: Fix false negatives in Style/SelfAssignment with a parenthesized right-hand side. (@koic)
  • #15761: Fix false positive for Layout/MultilineMethodCallIndentation when a method chain is inside a block, begin, if or loop body in a hash pair value. (@amritk)
  • #14520: Fix false positives for Lint/UselessAssignment when a loop condition variable is reassigned in a loop body inside a method. (@mattyb)
  • #15803: Fix false positives for Lint/UselessAssignment when a variable reassigned in a conditional in begin is referenced in rescue. (@mattyb)
  • #15822: Fix false positives in Layout/CaseIndentation when using IndentOneStep: true with tab indentation. (@koic)
  • #15828: Fix false positives in Layout/SpaceAfterNot when the argument is a unary ~. (@koic)
  • #15829: Fix false positives in Style/DoubleNegation when using three or more negations. (@koic)
  • #15783: Fix --changed missing untracked files outside the current directory when run from a subdirectory. (@bbatsov)
  • #15838: Fix incorrect autocorrects for Lint/LiteralAsCondition with an if used as a value or a post-loop containing break, next or redo. (@bbatsov)
  • #15779: Fix --diff writing the corrected file to disk, and leaving the removal out of the patch, when the file has a redundant rubocop:disable. (@bbatsov)
  • #15363: Fix Lint/RedundantCopDisableDirective reporting 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/MisplacedMagicComment that pushed an effective encoding comment off the first line when moving a frozen_string_literal comment. (@bbatsov)
  • #15751: Fix an infinite loop when autocorrecting Layout/HashAlignment with EnforcedHashRocketStyle: separator together with Layout/SpaceAroundOperators by 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/HashAlignment with EnforcedHashRocketStyle: separator together with Layout/SpaceAroundOperators by skipping offenses for keys that are too wide to right-align with the first key. (@Starlexxx)
  • #15692: Fix Parser::ClobberingError for Layout/RedundantLineBreak when autocorrecting nested assignments with a multiline right-hand side. (@Starlexxx)
  • #15713: Fix an infinite loop when autocorrecting Layout/SpaceAroundKeyword together with Layout/SpaceBeforeBlockBraces with EnforcedStyle: no_space for 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/NumericPredicate autocorrections. (@saidM)
  • #9325: Fix preview not merging an inherited Exclude when AllCops: Preview comes after the cop in an inherited file, or from an earlier file in inherit_from. (@bbatsov)
  • #15363: Fix AllCops: Preview being ignored, and --preview leaking into the default configuration, when an extension injects defaults via ConfigLoader.inject_defaults! or a plugin is loaded. (@bbatsov)
  • #15937: Fix the notice that --parallel is being ignored going to stdout, where it broke --format json output. (@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: Preview value being silently treated as false instead 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 note as the default level of Security cops, whose results are reported as warning. (@bbatsov)
  • #15783: Fix --changed skipping 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 sarif output being followed by the diff under --diff or the corrected source under --stdin --autocorrect, which made it invalid JSON. (@bbatsov)
  • #15720: Fix rubocop -a leaving 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 mcp gem to versions below 1.0. (@bbatsov)
  • #15784: Fix Style/DisableCopsWithinSourceCodeDirective ignoring the obsolete AllowTrailingComment setting instead of treating it as AllowWithReason. (@bbatsov)
  • #15784: Fix Style/DisableCopsWithinSourceCodeDirective ignoring AllowedCops for rubocop:push/rubocop:next arguments and leaving an orphan rubocop:pop when correcting a rubocop:push. (@bbatsov)
  • #16007: Fix Style/ExactRegexpMatch treating string === regexp as a regexp match. (@bbatsov)
  • #15741: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with EnforcedStyle: require_parentheses when the argument is a grouped expression containing a keyword operator, modifier, or multiple statements. (@Starlexxx)
  • #15712: Fix an infinite loop when autocorrecting Style/MissingElse together with Style/GuardClause when the conditional branch is a guard clause. (@Starlexxx)
  • #15995: Fix Style/Semicolon dropping arguments and erroring on yield/super with hash value omission. (@bbatsov)
  • #15783: Fix --changed lib failing with an error instead of inspecting the changed files under lib. (@bbatsov)
  • #16001: Fix the obsolete config message for a removed cop without alternatives. (@bbatsov)
  • #16012: Fix the offenses and worst formatters printing "Total in 1 files". (@bbatsov)

Changes

  • #16010: Load net/http only when a remote config is fetched, instead of on every run. (@bbatsov)
  • #15732: Check requires_gem requirements against target_gem_version, so that an extension can honor its own target version setting under AllCops, like TargetRailsVersion, by overriding it. (@koic)
  • #15843: Mark Style/NegativeArrayIndex as unsafe. (@bbatsov)
  • #15896: Report offenses from the MCP server's rubocop_inspection tool in the --format json shape instead of as LSP diagnostics, with inline code results in the same files-and-summary form as file results. (@bbatsov)
  • #15701: Make --show-cops and --show-docs-url report unrecognized cop names and exit non-zero, instead of silently ignoring them. (@bbatsov)

Don't miss a new rubocop release

NewReleases is sending notifications on new releases.