Skip to content

Releases

RuboCop v1.92.2

Choose a tag to compare

@github-actions github-actions released this 29 Oct 09:50

Bug fixes

  • #16147: Fix a false negative for Lint/RedundantCopDisableDirective when autocorrection shifts lines. (@koic)
  • #16104: Fix a false negative for Style/FloatDivision with a trailing comment. (@a-lavis)
  • #16146: Fix a false positive for Lint/RedundantCopDisableDirective with a repeated disable. (@koic)
  • #16176: Fix a false positive for Style/RaiseArgs with EnforcedStyle: compact and constructor arguments. (@bbatsov)
  • #16183: Fix an error for Layout/RescueEnsureAlignment with index or-assignment. (@koic)
  • #16158: Fix an error for Style/NumericPredicate with a predicate nested in the receiver of another. (@Starlexxx)
  • #16125: Fix an error for Style/RedundantCondition with a nested modifier if. (@koic)
  • #16175: Fix an incorrect autocorrect for Layout/HashAlignment with multiple styles and pairs on one line. (@bbatsov)
  • #16139: Fix an incorrect autocorrect for Layout/LineLength with code after a heredoc opener. (@koic)
  • #16160: Fix an incorrect autocorrect for Layout/SingleLineBlockChain with Style/MapToSet. (@koic)
  • #16002: Fix an incorrect autocorrect for Layout/SpaceBeforeBlockBraces with a brace after a line continuation. (@Starlexxx)
  • #16175: Fix an incorrect autocorrect for Layout/SpaceBeforeBlockBraces with a brace after a heredoc body. (@bbatsov)
  • #16180: Fix an incorrect autocorrect for Lint/InterpolationCheck in a split string. (@Starlexxx)
  • #16143: Fix an incorrect autocorrect for Lint/ParenthesesAsGroupedExpression with a command call operand. (@koic)
  • #16170: Fix an incorrect autocorrect for Lint/RedundantSplatExpansion with Array.new as a method argument. (@wleeaf)
  • #16178: Fix an incorrect autocorrect for Style/AndOr with a binary operator method operand. (@bbatsov)
  • #16150: Fix an incorrect autocorrect for Style/AndOr with a command call that takes a do block. (@Starlexxx)
  • #16178: Fix an incorrect autocorrect for Style/AndOr with a method chained onto a command call's do block. (@bbatsov)
  • #16178: Fix an incorrect autocorrect for Style/AndOr with a negated command call that takes a do block. (@bbatsov)
  • #16178: Fix an incorrect autocorrect for Style/AndOr with a pattern matching, ternary, range or defined? operand. (@bbatsov)
  • #16178: Fix an incorrect autocorrect for Style/AndOr with super called with arguments. (@bbatsov)
  • #16171: Fix an incorrect autocorrect for Style/CaseEquality with a non-numeric range. (@wleeaf)
  • #16127: Fix an incorrect autocorrect for Style/ClassAndModuleChildren with Style/DataInheritance. (@koic)
  • #16154: Fix an incorrect autocorrect for Style/EndlessMethod with modifier cops. (@koic)
  • #16167: Fix an incorrect autocorrect for Style/HashAsLastArrayItem with Layout/MultilineArrayBraceLayout. (@Starlexxx)
  • #16126: Fix an incorrect autocorrect for Style/HashLookupMethod with forwarded or splatted arguments. (@koic)
  • #16163: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with Layout/HeredocArgumentClosingParenthesis. (@koic)
  • #16124: Fix an incorrect autocorrect for Style/MethodDefParentheses with a line continuation. (@koic)
  • #16159: Fix an incorrect autocorrect for Style/ParenthesesAroundCondition with a command call assignment. (@koic)
  • #16137: Fix an incorrect autocorrect for Style/QuotedSymbols with a trailing backslash. (@koic)
  • #16176: Fix an incorrect autocorrect for Style/RaiseArgs compact style with e.class as the exception. (@bbatsov)
  • #16169: Fix an incorrect autocorrect for Style/RaiseArgs with a heredoc message. (@Starlexxx)
  • #16132: Fix an incorrect autocorrect for Style/RaiseArgs with a parenthesized raise. (@koic)
  • #16136: Fix an incorrect autocorrect for Style/ReduceToHash with a heredoc. (@koic)
  • #16162: Fix an incorrect autocorrect for Style/RedundantBegin with a ternary branch. (@koic)
  • #16176: Fix an incorrect autocorrect for Style/RedundantException with a heredoc in a multiline call. (@bbatsov)
  • #16177: Fix an incorrect autocorrect for Style/SingleLineMethods with code after the method's end. (@bbatsov)
  • #16157: Fix an incorrect autocorrect for Style/StringConcatenation when joining parts forms an interpolation. (@Starlexxx)
  • #16161: Fix an incorrect autocorrect for Style/TrailingCommaInArguments with argument forwarding. (@koic)
  • #16182: Fix an infinite loop for Layout/EmptyLinesAfterModuleInclusion with a logical operator. (@Starlexxx)
  • #16138: Fix an infinite loop for Layout/EmptyLinesAroundClassBody with Layout/IndentationWidth. (@koic)
  • #16142: Fix an infinite loop for Layout/EndAlignment with a class or module assigned to a constant. (@Starlexxx)
  • #16128: Fix an infinite loop for Layout/ExtraSpacing with Layout/LineLength. (@koic)
  • #16148: Fix an infinite loop for Layout/SpaceAroundOperators with Layout/LineContinuationSpacing. (@Starlexxx)
  • #16123: Fix an infinite loop for Layout/SpaceAroundOperators with hash rockets aligned on non-adjacent lines. (@koic)
  • #16144: Fix an infinite loop for Layout/SpaceInsideBlockBraces with Layout/BlockAlignment. (@koic)
  • #16145: Fix an infinite loop for Layout/SpaceInsideRangeLiteral with a nested endless range. (@koic)
  • #15609: Fix an infinite loop and an incorrect autocorrect for Style/EndlessMethod when the method definition itself has a modifier if/unless/while/until or is followed by and/or/&&/||. (@Starlexxx)
  • #16153: Fix an infinite loop for Style/RedundantBegin and Style/IfUnlessModifier with Layout/SpaceInsideParens. (@koic)
  • #16168: Fix false positives for Lint/NestedPercentLiteral when a percent literal contains format sequences such as %-5s or %.2f. (@Vitalini)
  • #16149: Fix false positives in Style/RedundantSelf with a splat in multiple assignment. (@koic)
  • #16134: Fix Layout/HashAlignment deleting a double splat before a pair on the same line. (@Starlexxx)
  • #14045: Warn about any obsolete configuration shipped by a plugin, naming the plugin and its file, instead of reporting a renamed cop against the user's .rubocop.yml. (@ihamzatarar)

Changes

  • #16066: Clarify when a cached remote configuration file is refreshed. (@pdobb)
  • #15855: Make Lint/PercentStringArray suggest an array literal for quoted strings split at whitespace. (@koic)

RuboCop v1.92.1

Choose a tag to compare

@github-actions github-actions released this 22 Oct 05:16

Bug fixes

  • #16063: Fix an error for Layout/HashAlignment with a key spanning multiple lines. ([@koic][])
  • #15776: Fix an error in server mode when the configuration file is missing or empty. ([@MIbtehajNasar][])
  • #15939: Fix an error for Style/ClassAndModuleChildren when compacting a namespace that contains another compactable one. ([@Starlexxx][])
  • #16047: Fix an error for Style/ClassMethodsDefinitions with a nested class << self. ([@Starlexxx][])
  • #16041: Fix an error for Style/EmptyStringInsideInterpolation with nested conditionals. ([@koic][])
  • #16067: Fix an error for Style/RedundantInterpolationUnfreeze with an unfrozen string interpolated into another one. ([@Starlexxx][])
  • #16055: Fix an error for Style/RescueModifier with a rescue modifier in the rescue body of another one. ([@Starlexxx][])
  • #15968: Fix an error when the target Ruby version lookup cannot list a directory for a gemspec or read a version file or lockfile, and stop the gemspec search at the project root. ([@koic][])
  • #16073: Fix an incorrect autocorrect for Layout/ClassStructure with code after a heredoc. ([@koic][])
  • #16026: Fix an incorrect autocorrect for Layout/DotPosition with a dot removed by another cop. ([@koic][])
  • #16107: Fix an incorrect autocorrect for Layout/HeredocArgumentClosingParenthesis with Layout/MultilineMethodCallBraceLayout. ([@koic][])
  • #16117: Fix an incorrect autocorrect for Layout/LineLength with an unparenthesized method definition. ([@koic][])
  • #16061: Fix an incorrect autocorrect for Layout/MultilineHashBraceLayout with a nested literal. ([@koic][])
  • #16033: Fix an incorrect autocorrect for Layout/MultilineMethodCallIndentation with a single-line block. ([@koic][])
  • #16077: Fix an incorrect autocorrect for Layout/SingleLineBlockChain with Style/RedundantSort. ([@koic][])
  • #16098: Fix an incorrect autocorrect for Lint/AmbiguousRegexpLiteral with a regexp hash key. ([@koic][])
  • #16086: Fix an incorrect autocorrect for Lint/SymbolConversion with hash value omission. ([@koic][])
  • #16099: Fix an incorrect autocorrect for Naming/RescuedExceptionsVariableName with Style/HashSyntax. ([@koic][])
  • #16023: Fix an incorrect autocorrect for Style/AccessModifierDeclarations with Style/EndlessMethod. ([@Starlexxx][])
  • #16024: Fix an incorrect autocorrect for Style/AccessModifierDeclarations with an endless method command body. ([@Starlexxx][])
  • #16111: Fix an incorrect autocorrect for Style/AccessModifierDeclarations with an endless method with a do...end block body. ([@koic][])
  • #16056: Fix an incorrect autocorrect for Style/AndOr with a safe navigation command call. ([@Starlexxx][])
  • #16043: Fix an incorrect autocorrect for Style/AndOr with Style/ReturnNil. ([@koic][])
  • #16020: Fix an incorrect autocorrect for Style/ArgumentsForwarding when another call forwards anonymous arguments without the block. ([@Starlexxx][])
  • #16038: Fix an incorrect autocorrect for Style/ArgumentsForwarding with index assignment and setter methods. ([@koic][])
  • #15067: Fix an incorrect autocorrect for Style/CollectionQuerying when count is used without a block. ([@Starlexxx][], [@wwenrr][])
  • #16032: Fix an incorrect autocorrect for Style/CombinableLoops with Layout/BlockEndNewline. ([@Starlexxx][])
  • #16072: Fix an incorrect autocorrect for Style/CombinableLoops with Layout/RedundantLineBreak. ([@koic][])
  • #16036: Fix an incorrect autocorrect for Style/ConcatArrayLiterals with a multiline call without parentheses. ([@koic][])
  • #16100: Fix an incorrect autocorrect for Style/EmptyStringInsideInterpolation with a command call. ([@koic][])
  • #16023: Fix an incorrect autocorrect for Style/EndlessMethod with a command body in a method definition passed as an argument. ([@Starlexxx][])
  • #16110: Fix an incorrect autocorrect for Style/EndlessMethod with a do...end block body in a method definition passed as an argument. ([@koic][])
  • #16042: Fix an incorrect autocorrect for Style/EndlessMethod with a negated command call. ([@koic][])
  • #16029: Fix an incorrect autocorrect for Style/EndlessMethod with Style/GuardClause. ([@koic][])
  • #16058: Fix an incorrect autocorrect for Style/EndlessMethod with Style/RaiseArgs. ([@Starlexxx][])
  • #16045: Fix an incorrect autocorrect for Style/For with a numbered or it block. ([@koic][])
  • #16046: Fix an incorrect autocorrect for Style/For with block parameters invalid as loop variables. ([@koic][])
  • #16044: Fix an incorrect autocorrect for Style/For with Style/ItBlockParameter. ([@koic][])
  • #16031: Fix an incorrect autocorrect for Style/GuardClause with a heredoc in a multiline guard clause. ([@Starlexxx][])
  • #16031: Fix an incorrect autocorrect for Style/GuardClause with a heredoc in the kept branch. ([@Starlexxx][])
  • #16021: Fix an incorrect autocorrect for Style/HashAsLastArrayItem with Style/TrailingCommaInArrayLiteral. ([@Starlexxx][])
  • #16027: Fix an incorrect autocorrect for Style/IfUnlessModifier with a heredoc in the condition. ([@koic][])
  • #16025: Fix an incorrect autocorrect for Style/Lambda with extra spacing before the block. ([@koic][])
  • #16054: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with a trailing comma. ([@koic][])
  • #16080: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with a parenthesized argument. ([@koic][])
  • #16074: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses with an assignment used as an argument. ([@koic][])
  • #16118: Fix an incorrect autocorrect for Style/MethodDefParentheses with Layout/LineLength. ([@koic][])
  • #16039: Fix an incorrect autocorrect for Style/MixinGrouping with parenthesized arguments. ([@koic][])
  • #16085: Fix an incorrect autocorrect for Style/MutableConstant with an omitted hash value. ([@koic][])
  • #16075: Fix an incorrect autocorrect for Style/MutableConstant with Recursive: true and Style/HashAsLastArrayItem. ([@koic][])
  • #16030: Fix an incorrect autocorrect for Style/RaiseArgs dropping required parentheses. ([@Starlexxx][])
  • #16101: Fix an incorrect autocorrect for Style/RedundantInterpolationUnfreeze with Layout/MultilineMethodCallBraceLayout. ([@koic][])
  • #16108: Fix an incorrect autocorrect for Style/RedundantInterpolationUnfreeze with a comment. ([@koic][])
  • #16040: Fix an incorrect autocorrect for Style/RedundantSelfAssignmentBranch with assignment used as value. ([@koic][])
  • #16076: Fix an incorrect autocorrect for Style/RedundantSort with a line break before the accessor. ([@koic][])
  • #16102: Fix an incorrect autocorrect for Style/RequireOrder without a trailing newline. ([@koic][])
  • #16037: Fix an incorrect autocorrect for Style/SendWithLiteralMethodName with Layout/MultilineMethodArgumentLineBreaks. ([@koic][])
  • #16062: Fix an incorrect autocorrect for Style/StructInheritance with Style/MethodCallWithArgsParentheses. ([@koic][])
  • #16103: Fix an incorrect autocorrect for Style/SymbolProc with Style/TrailingCommaInArguments. ([@koic]...
Read more

RuboCop v1.92.0

Choose a tag to compare

@github-actions github-actions released this 10 Oct 09:34

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](https://github.com/rubocop/ruboco...
Read more

RuboCop v1.91.0

Choose a tag to compare

@github-actions github-actions released this 10 Sep 13:55

New features

  • #15631: Add a preview channel for unstable behavior. (@bbatsov)
  • #15627: Add a SARIF formatter. (@bbatsov)
  • #15686: Add AllCops: FailLevel, the configuration equivalent of --fail-level. (@bbatsov)
  • #15650: Add AllowedDirectives option to Style/DisableCopsWithinSourceCodeDirective, exempting directive kinds such as generated rubocop:todo comments. (@bbatsov)
  • #15629: Add --changed to inspect only the files git says changed. (@bbatsov)
  • #15628: Add --diff to preview autocorrection without writing files. (@bbatsov)
  • #15615: Add new Lint/MisplacedMagicComment cop to flag magic comments in positions where Ruby ignores them. (@bbatsov)
  • #15600: Add the rubocop:enable-next directive to re-enable cops for the next statement only. (@bbatsov)
  • #15600: Add the rubocop:next directive, combining push-style +/- arguments with disable-next's statement scope. (@bbatsov)
  • #15363: Let a cop's entry in the default configuration carry a Preview section with the defaults it is expected to adopt in the next major release, applied under Preview. (@bbatsov)

Bug fixes

  • #15349: Fix a false positive for Style/RedundantRegexpCharacterClass with \8/\9. (@bbatsov)
  • #15646: Fix an error for Layout/ElseAlignment when else is used with rescue in a class, module, or singleton class body. (@viralpraxis)
  • #15613: Fix an error for Layout/HashAlignment when a hash value starts on the line below its key. (@viralpraxis)
  • #15623: Fix an error for Layout/HashAlignment when the first pair of a hash omits its value, and an incorrect autocorrection when a later pair does. (@viralpraxis)
  • #15602: Fix an error for Layout/IndentationWidth on under-indented code with tab indentation. (@Starlexxx)
  • #15672: Fix an error for Lint/RedundantCopDisableDirective when a file contains more than one rubocop:push/rubocop:pop pair. (@koic)
  • #15625: Fix an error for Style/AccessModifierDeclarations when a body repeats the same access modifier. (@viralpraxis)
  • #15603: Fix an error for Style/AccessModifierDeclarations with EnforcedStyle: inline when an access modifier is the body of an if without an else branch. (@viralpraxis)
  • #15604: Fix an error for Style/ConstantVisibility when a visibility declaration splats anything other than an array literal, e.g. private_constant(*constants(false)). (@viralpraxis)
  • #15647: Fix an error for Style/DocumentationMethod when an inline module_function/ruby2_keywords def is preceded by another argument. (@viralpraxis)
  • #15680: Fix an error for Style/EndlessMethod when a method definition is nested inside another method definition. (@viralpraxis)
  • #15674: Fix an error for Style/FloatDivision when using EnforcedStyle: fdiv and one operand of a float division is itself a parenthesized float division. (@viralpraxis)
  • #15624: Fix an error for Style/HashLookupMethod when the looked-up key is itself a hash lookup. (@viralpraxis)
  • #15642: Fix an error for Style/HashSyntax when hash rockets are enforced and a hash value repeats its key. (@viralpraxis)
  • #15634: Fix an incorrect autocorrect for Lint/LiteralAsCondition when the other operand is a parenthesized return. (@Starlexxx)
  • #15648: Fix an incorrect autocorrect for Lint/ParenthesesAsGroupedExpression when the parentheses contain and, or, not, or a modifier expression. (@Starlexxx)
  • #15612: Fix an incorrect autocorrect for Naming/BlockForwarding with Style/MethodDefParentheses. (@Starlexxx)
  • #15680: Fix an incorrect autocorrect for Style/EndlessMethod when using EnforcedStyle: require_always and the method body has a rescue or ensure clause. (@viralpraxis)
  • #15669: Fix an incorrect autocorrect for Style/FloatDivision when using EnforcedStyle: fdiv and the divisor is a method call with parenthesized arguments. (@viralpraxis)
  • #15678: Fix an incorrect autocorrect for Style/For when using EnforcedStyle: for and the block body has a rescue or ensure clause. (@viralpraxis)
  • #15645: Fix an incorrect autocorrect for Style/GuardClause with Style/MissingElse. (@Starlexxx)
  • #15668: Fix an incorrect autocorrect for Style/MethodCallWithArgsParentheses when EnforcedStyle: omit_parentheses is used together with Style/TrailingCommaInArguments. (@viralpraxis)
  • #15347: Fix an incorrect autocorrect for Style/NestedModifier. (@bbatsov)
  • #15347: Fix an incorrect autocorrect for Style/NonNilCheck. (@bbatsov)
  • #15347: Fix an incorrect autocorrect for Style/Not with a flip-flop or assignment. (@bbatsov)
  • #15349: Fix an incorrect autocorrect for Style/RedundantDoubleSplatHashBraces with a braced merge argument. (@bbatsov)
  • #15349: Fix an incorrect autocorrect for Style/RedundantParentheses around and/or. (@bbatsov)
  • #15349: Fix an incorrect autocorrect for Style/RedundantRegexpConstructor with %r{} delimiters. (@bbatsov)
  • #15614: Fix an infinite loop between Layout/ArgumentAlignment and Layout/HashAlignment with separator style. (@Starlexxx)
  • #15599: Fix an infinite loop error for Layout/CommentIndentation when many comment blocks with the same indentation are separated by empty lines. (@Starlexxx)
  • #15597: Fix an infinite loop error for Layout/EmptyLinesAfterModuleInclusion when a module inclusion is directly before rescue. (@Starlexxx)
  • #15617: Fix an infinite loop between Layout/ExtraSpacing with ForceEqualSignAlignment and Layout/SpaceAroundOperators. (@Starlexxx)
  • #15638: Fix an infinite loop error for Layout/FirstArrayElementIndentation with Layout/ArrayAlignment when EnforcedStyle: with_fixed_indentation is configured. (@RedZapdos123)
  • #15639: Fix an infinite loop error for Layout/FirstParameterIndentation with Layout/ParameterAlignment when EnforcedStyle: with_fixed_indentation is configured. (@RedZapdos123)
  • #15619: Fix an infinite loop for Layout/LineLength with SplitStrings: true when the split point lands on a trailing space. (@Starlexxx)
  • #15675: Fix an infinite loop between Layout/SpaceAroundOperators and Layout/ExtraSpacing with ForceEqualSignAlignment: true for aligned operator assignments. (@Starlexxx)
  • #15598: Fix an infinite ...
Read more

RuboCop v1.90.0

Choose a tag to compare

@github-actions github-actions released this 24 Aug 11:40

New features

  • #15073: Add AllowTrailingComment option to Style/DisableCopsWithinSourceCodeDirective. (@bbatsov)
  • #9505: Add disable-next directives scoped to the following statement. (@bbatsov)
  • #15550: Add --display-suppressed option to also report offenses suppressed by directive comments, including their -- justification in the JSON formatter. (@bbatsov)
  • #15523: Add new Lint/ArgumentMismatch cop. (@bbatsov)
  • #15594: Add new Lint/SuperArgumentMismatch cop. (@bbatsov)
  • #15581: Add new Style/TimeNow cop. (@Starlexxx)
  • #15111: Add NumberOfEmptyLines option to Layout/EmptyLineAfterMagicComment to configure the minimum number of empty lines required after magic comments. (@alejofraga)
  • #13037: Add --report-unused-todo-entries to catch rotting todo files. (@bbatsov)
  • #15559: Add new Style/DirectiveScope cop to flag disable/enable pairs and disable-only push/pop scopes that wrap a single statement and can use disable-next instead. (@bbatsov)
  • #15547: Make Lint/RedundantCopEnableDirective flag # rubocop:pop directives without a matching # rubocop:push. (@bbatsov)

Bug fixes

  • #15584: Fix a crash in Lint/NameTypo and Lint/UnusedPrivateMethod on string literals with invalid encoding. (@bbatsov)
  • #15541: Fix a false negative for Lint/OutOfRangeRegexpRef when a preceding element access with a non-string literal argument (e.g. hash[:key]) discarded the tracked capture count. (@koic)
  • #7958: Add todo comments for skipped unsafe corrections with --disable-uncorrectable. (@bbatsov)
  • #15569: Fix an error for the built-in language server when a workspace/executeCommand request has no document URI in its arguments. (@koic)
  • #15410: Fix an incorrect autocorrect for Naming/BinaryOperatorParameterName. (@bbatsov)
  • #15576: Fix an incorrect autocorrect for Style/Sample when shuffle is given a random: argument; the offense is still reported but no longer autocorrected, since shuffle and sample consume a seeded generator differently and would select different elements. (@koic)
  • #15590: Fix an infinite loop error for Layout/FirstArgumentIndentation when EnforcedStyle: with_fixed_indentation is specified for Layout/ArgumentAlignment and Layout/FirstMethodArgumentLineBreak is enabled with AllowMultilineFinalElement: true. (@Starlexxx)
  • #15588: Fix RuboCop::Cop::IgnoredMethods and RuboCop::Cop::IgnoredPattern being unreachable after require 'rubocop'. (@SeanLF)
  • #8349: Don't autocorrect away directives for unknown cops. (@bbatsov)
  • #7894: Don't flag disables of pending cops as redundant. (@bbatsov)
  • #9963: Fix false negatives for Layout/ExtraSpacing. (@Starlexxx)
  • #15525: Fix false negatives in Layout/LineLength when a constant path like Http::UploadedFile matches URISchemes case-insensitively. (@koic)
  • #13941: Fix false positives for Lint/UselessConstantScoping when assigning with Class.new, Module.new, Struct.new, or Data.define after private. (@pdobb)
  • #15526: Fix false positives in Layout/MultilineMethodCallIndentation when a line has multiple single-line blocks before a multiline block. (@koic)
  • #15538: Fix false positives in Lint/ConstantReassignment when a constant is assigned in compact-style namespaces (e.g. module A::B). (@alex-tan)
  • #15517: Fix false positives in Lint/RedundantSafeNavigation when InferNonNilReceiver is enabled and the receiver name is rebound by a nested block (it or a shadowed block parameter). (@koic)
  • #15572: Fix RuboCop::Cop::Registry#freeze to freeze its internal collections, so that registering a lazily loaded cop after the freeze fails fast at the registration site instead of corrupting the registry. (@koic)
  • #15585: Make Lint/DuplicateMethods honor silence_redefinition_of_method and redefine_method as intentional redefinitions. (@bbatsov)
  • #15558: Fix --display-suppressed reporting a nil justification when the offense is loaded from the result cache. (@corsonknowles)
  • #10449: Fix Layout/ClassStructure autocorrection producing a wrong order when an element cannot be moved, and make offenses report the category that actually blocks the expected order. (@koic)
  • #15568: Fix Lint/NameTypo registering false positives for names provided by a gem whose namespace the project reopens, and for constants read from a namespace with an unresolved ancestor. (@HoneyryderChuck)
  • #15556: Fix Lint/UnusedPrivateMethod retaining every past project_index object it has seen (and the index graph reachable from each), rather than only the most recent one. This caused unbounded memory growth in long-lived processes such as rubocop --server. (@bquorning)
  • #10046: Fix Lint/UselessMethodDefinition false positive for methods with **kwargs. (@bbatsov)
  • #15589: Fix --lsp and --mcp being silently ignored when the RuboCop server is running: they now start the protocol server in the current process instead of being forwarded to the server as a lint request. (@koic)
  • #11148: Merge department and cop-level Exclude settings. (@bbatsov)
  • #15531: Fix a regression in RuboCop 1.89 where the modifier cops could produce lines longer than Layout/LineLength Max when exemptions like AllowedPatterns matched the result. (@bbatsov)
  • #15574: Fix an incorrect warning such as AllCops does not support TargetRailsVersion parameter when a plugin declares a custom AllCops key with a nil value and another plugin is loaded after it. (@koic)
  • #9543: Preserve escape notation in Style/StringConcatenation autocorrect. (@bbatsov)
  • #11119: Preserve persistent cop instances across files. (@Eljees)
  • #13022: Fix rubocop . (and other relative directory arguments) needlessly traversing directories excluded by the configuration, which made it much slower than rubocop in projects with large ignored trees. (@bbatsov)
  • #15561: Fix Lint/RedundantCopDisableDirective and Lint/RedundantCopEnableDirective leaving a directive's -- reason behind when removing the directive. (@corsonknowles)
  • #15593: Fix false positives for Lint/UnusedPrivateMethod for private definitions of Ruby runtime hooks like inherited and const_missing. (@bbatsov)
  • #15547: Make Lint/MissingCopEnableDirective suggest # rubocop:pop instead of # rubocop:enable for an unclosed # rubocop:push. (@bbatsov)
  • #14379: Suppress multi-line offenses with a directive on any of their lines. (@bbatsov)
  • [#15593](https://github.com/rubocop/ru...
Read more

RuboCop v1.89.0

Choose a tag to compare

@github-actions github-actions released this 04 Aug 09:00

New features

  • #15492: Add AllCops/ProjectIndexIncludesGems for bundle-wide indexing. (@bbatsov)
  • #15498: Add DelegatingMethods option to Lint/DuplicateMethods to register custom delegate-shaped methods. (@bbatsov)
  • #15042: Add DisallowedCops configuration option to Style/DisableCopsWithinSourceCodeDirective. (@hammadxcm)
  • #15441: Add new AllowYARDCommentBlockSeparator option to Layout/LeadingCommentSpace. (@koic)
  • #15466: Add new Lint/DeprecatedReference cop to detect references to methods and constants documented as @deprecated, powered by the project index. (@bbatsov)
  • #15491: Add new Lint/NameTypo cop. (@bbatsov)
  • #15468: Add new Lint/UnusedPrivateMethod cop for project-wide dead-code detection via the project index (disabled by default). (@bbatsov)
  • #14598: Make Style/DisableCopsWithinSourceCodeDirective impossible to disable via directive comments when explicitly enabled with Enabled: true. (@rafaelfranca)
  • #15511: Support textDocument/codeAction requests in the built-in language server, so LSP clients that request code actions (Eglot, Helix, Flycheck, ...) can apply RuboCop's autocorrects, not only clients that read them off the published diagnostic. (@bbatsov)
  • #8565: Support NewCops in department configuration to enable pending cops per department, including cops added up to a specific version (e.g. Style: NewCops: '1.19'). (@koic)
  • #9373: Support autocorrection for tab indentation in Layout/IndentationWidth and Style/ClassAndModuleChildren. (@ioquatix, @koic)

Bug fixes

  • #15257: Fix a false negative for Lint/ToEnumArguments when explicit extra keyword arguments are passed (e.g. def m(x:); to_enum(:m, x: x, y: 1); end), which raises ArgumentError when the enumerator is used. (@RedZapdos123)
  • #15452: Fix a false positive for Layout/HashAlignment when using EnforcedHashRocketStyle: table and a hash key spans multiple lines. (@dduugg)
  • #12269: Fix a false positive for Lint/UselessAssignment with modifier conditions. (@bbatsov)
  • #13786: Fix a false positive for Lint/Void with setter methods. (@bbatsov)
  • #15507: Fix a false positive for Naming/VariableNumber when using an empty symbol hash key. (@koic)
  • #15284: Fix a false positive for Style/MutableConstant with Data.define. (@bbatsov)
  • #15483: Fix a false positive for Style/MissingRespondToMissing when respond_to_missing? is defined in a reopening of the class and UseProjectIndex is enabled. (@bbatsov)
  • #15500: Fix an error for Lint/LiteralAsCondition when a literal condition has an empty branch. (@koic)
  • #15499: Fix an error for Lint/UselessRuby2Keywords when ruby2_keywords is used with a symbol but no method definition is found. (@koic)
  • #15453: Fix an error for Metrics/MethodLength when a method contains a heredoc and __ENCODING__. (@koic)
  • #15442: Fix an error for Style/ArrayIntersect cop when the block-based check calls member?/include? without an explicit receiver. (@dduugg)
  • #15434: Fix an error for Style/NegativeArrayIndex cop. (@viralpraxis)
  • #15469: Fix an error for Style/RedundantFormat when a format string uses a positional argument number beyond the 64-bit range. (@koic)
  • #15454: Fix an error for Style/RedundantFormat when the argument for a positional variable width is missing. (@koic)
  • #15298: Fix an incorrect autocorrect for Lint/LiteralInInterpolation. (@bbatsov)
  • #15515: Fix an incorrect autocorrect for Style/ArrayIntersect when using safe navigation none? with a block. (@koic)
  • #15364: Fix an incorrect autocorrect for Style/MultipleComparison that dropped an allowed method comparison appearing between the compared values. (@bbatsov)
  • #15367: Fix an incorrect autocorrect for Style/RedundantFileExtensionInRequire that produced invalid Ruby when a backslash preceded the .rb extension. (@bbatsov)
  • #12017: Fix Lint/Void to no longer autocorrect a constant used in a void context, since removing it can change behavior through constant autoloading side effects. (@bbatsov)
  • #14797: Avoid cache writes during server checks. (@sjh9714)
  • #15484: Fix false negatives for Lint/InheritException when Exception is inherited indirectly through a project class (UseProjectIndex). (@bbatsov)
  • #15357: Fix a false negative for Lint/AmbiguousAssignment when using attribute or index assignment. (@sngsmz)
  • #9571: Fix false negatives in Layout/ClassStructure when class body elements are wrapped in begin blocks. (@koic)
  • #9570: Fix false negatives in Layout/ClassStructure when using private_class_method or public_class_method def modifiers. (@koic)
  • #15438: Fix false positives in Style/ArrayIntersect when the receiver of include? in a block is not an array literal. (@koic)
  • #15445: Fix false positives in Style/MultilineIfThen when using the Prism parser engine and an elsif without then follows a branch using then with a body on the same line. (@koic)
  • #15058: Fix false positives in Lint/DuplicateMethods for anonymous classes (Class.new) passed as arguments to the same named-receiver method call (e.g. T.cast). Each Class.new block is an independent class, so methods defined in different blocks should not be treated as duplicates. (@rafaelfranca)
  • #15486: Fix false negatives for Style/RedundantConstantBase inside namespaces when the constant provably resolves identically without :: (UseProjectIndex). (@bbatsov)
  • #15505: Fix incompatible autocorrect between Style/Lambda and Style/SymbolProc producing a syntax error like ->(x)(&:method) when both cops run on lambda { |x| x.method }. (@koic)
  • #15481: Fix cross-file offenses depending on which files are inspected: the project index now always covers the whole project (UseProjectIndex). (@bbatsov)
  • #13794: Fix Layout/LineLength autocorrection for endless methods with block bodies. (@hervetatche)
  • #15462: Fix an error for Lint/ConstantReassignment when a built-in constant name is assigned and UseProjectIndex is enabled. (@bbatsov)
  • #15321: Fix Style/ClassAndModuleChildren ignoring EnforcedStyleForClasses and EnforcedStyleForModules, and skip autocorrection when mixed per-type styles make the result ambiguous. (@bbatsov)
  • #15122: Fix false positive in Layout/MultilineMethodCallIndentation when a line has multiple chained calls before a single-line block. (@hammadxcm)...
Read more

RuboCop v1.88.2

Choose a tag to compare

@github-actions github-actions released this 08 Jul 06:22

Bug fixes

  • #15417: Fix a false negative for Lint/ToJSON, which did not flag singleton def self.to_json definitions. (@bbatsov)
  • #15418: Fix a false negative for Lint/UnreachableCode, which only flagged the first statement after a flow-of-control statement instead of every unreachable statement that followed it. (@bbatsov)
  • #15416: Fix a false negative for Lint/UselessNumericOperation, which only flagged bare method-call receivers and ignored local variables, instance/class/global variables, and constants (e.g. @x + 0, CONST * 1). (@bbatsov)
  • #15419: Fix a false negative for Lint/Void where safe-navigation calls to nonmutating methods (e.g. x&.sort) were not flagged when CheckForMethodsWithNoSideEffects is enabled. (@bbatsov)
  • #15421: Fix a false negative for Style/ArrayIntersect with the block form using include? (e.g. array1.any? { |e| array2.include?(e) }), which was only detected for member?. (@bbatsov)
  • #15420: Fix a false negative for Style/CollectionCompact, which did not flag grep_v(nil)/grep_v(NilClass) on a safe-navigation call (e.g. array&.grep_v(nil)). (@bbatsov)
  • #15422: Fix a false negative for Style/DefWithParentheses with a single-line definition whose body follows a semicolon (e.g. def foo(); end), where the parentheses can be safely omitted. (@bbatsov)
  • #15388: Fix a false negative for Style/MixinUsage when including multiple modules in one statement. (@bbatsov)
  • #15388: Fix a false negative for Style/ModuleFunction when the module body is a single statement. (@bbatsov)
  • #15388: Fix a false negative for Style/RedundantCurrentDirectoryInPath with double-quoted strings containing interpolation. (@bbatsov)
  • #15395: Fix a false negative for Style/RedundantHeredocDelimiterQuotes with double-quoted delimiters whose body contains interpolation or escapes. (@bbatsov)
  • #15409: Fix a false positive for Gemspec/DuplicatedAssignment with multiple specifications. (@bbatsov)
  • #15403: Fix a false positive for Layout/CommentIndentation with a comment above an inline access modifier (e.g. private def foo) when Layout/AccessModifierIndentation is configured with EnforcedStyle: outdent. (@grk)
  • #15372: Fix a false positive for Style/InvertibleUnlessCondition with a multi-statement begin condition. (@bbatsov)
  • #15360: Fix an incorrect autocorrect for Style/ArgumentsForwarding and Style/MethodDefParentheses when autocorrection conflicts while adding parentheses to method definition arguments. (@koic)
  • #15417: Fix an incorrect autocorrect for Lint/ToJSON that produced invalid Ruby (def to_json(*_args)()) when the method had explicit empty parentheses. (@bbatsov)
  • #15426: Fix an incorrect autocorrect for Style/MethodCallWithoutArgsParentheses when empty parentheses span multiple lines and the method call has a block. (@koic)
  • #15328: Fix a false positive for Style/HashConversion with a splat argument, which previously produced an invalid hash literal. (@bbatsov)
  • #15338: Fix a false positive for Style/HashLookupMethod with safe navigation, where the suggested bracket form would be the unreadable hash&.[](key). (@bbatsov)
  • #15397: Fix an incorrect autocorrect for Style/IdenticalConditionalBranches that hoisted the moved expression to column zero instead of matching the surrounding indentation. (@bbatsov)
  • #15372: Fix an incorrect autocorrect for Style/InvertibleUnlessCondition with mixed &&/|| conditions, which lost the required parentheses when inverting. (@bbatsov)
  • #15428: Fix an incorrect autocorrect for Style/TrivialAccessors when AllowPredicates: false is set and a trivial reader is defined as a predicate class method. (@koic)
  • #15402: Fix an infinite loop and file corruption for Layout/LineLength with SplitStrings when an over-long string is indented under a multi-line parent. (@bbatsov)
  • #15384: Fix a false positive and a false negative for Style/MissingRespondToMissing when method_missing is defined at the top level or alongside sibling classes. (@bbatsov)
  • #15432: Fix false positives in Layout/ElseAlignment when using else within a block that is part of a larger expression. (@koic)
  • #15423: Fix false positives in Layout/MultilineMethodCallIndentation when a method chain is nested inside a parenthesized argument list or a grouped expression within a hash pair value. (@koic)
  • #15424: Fix Style/StructInheritance autocorrect dropping leading indentation when class is inside a module or namespace. (@amckinnie)
  • #15325: Fix Style/DocumentationMethod ignoring AllowedMethods for inline modifier defs. (@bbatsov)
  • #15369: Fix a false positive for Style/LambdaCall when the argument list contains a comment, which the autocorrect would have dropped. (@bbatsov)

Changes

  • #15430: Improve performance of offense reporting by not allocating a new source range per offense outside of embedded sources. (@bbatsov)
  • #15430: Improve investigation performance by dispatching on_new_investigation, on_investigation_end, and on_other_file only to cops that refine them, and by skipping after_* dispatch when no cop needs it. (@bbatsov)
  • #15430: Improve performance of the per-file cop relevancy check by skipping gem requirement evaluation for cops without gem requirements. (@bbatsov)
  • #15430: Improve Lint/Debugger performance on code without debugger calls. (@bbatsov)
  • #15430: Improve autocorrection performance by keeping corrections in memory across inspection iterations and writing each corrected file only once. (@bbatsov)
  • #15415: Mark Lint/NumericOperationWithConstantResult autocorrect as unsafe because it drops the operands, discarding their side effects and silencing cases where the result is not actually constant (e.g. x / x raises when x is 0). (@bbatsov)
  • #15430: Improve performance of cops using AllowedPatterns, ForbiddenPatterns, and AllowedMethods by compiling the configured patterns only once. (@bbatsov)
  • #15430: Improve performance of Style/IfUnlessModifier and other modifier cops on files with many comments or conditionals. (@bbatsov)

RuboCop v1.88.1

Choose a tag to compare

@github-actions github-actions released this 01 Jul 09:52

Bug fixes

  • #15408: Fix a crash for Bundler/GemComment with a non-literal gem option key. (@bbatsov)
  • #9571: Fix a crash for Layout/ClassStructure when a class body is a single safe-navigation call (e.g. test&.private_methods(def foo; end)). (@bbatsov)
  • #15413: Fix a crash for Gemspec/DevelopmentDependencies when AllowedGems is nil. (@bbatsov)
  • #15404: Fix a crash for Metrics/MethodLength with an anonymous define_method. (@bbatsov)
  • #15414: Fix a crash for Naming/InclusiveLanguage with nil or empty FlaggedTerms. (@bbatsov)
  • #15405: Fix a crash for Security/IoMethods with a non-string-literal argument. (@bbatsov)
  • #15330: Fix a crash for Style/EmptyStringInsideInterpolation with a modifier conditional. (@bbatsov)
  • #15351: Fix a crash for Style/OpenStructUse with a bare OpenStruct root node. (@bbatsov)
  • #15379: Fix a crash for Style/TrailingUnderscoreVariable when a nested destructuring group consists only of underscore variables. (@bbatsov)
  • #15412: Fix a false negative for Security/MarshalLoad with a proc argument. (@bbatsov)
  • #15386: Fix a false negative for Style/MethodDefParentheses with named rest arguments under EnforcedStyle: require_no_parentheses. (@bbatsov)
  • #15396: Fix a false negative for Style/MultilineMethodSignature where a signature that fits on one line was skipped because the multi-line source length was measured instead of the collapsed width. (@bbatsov)
  • #15386: Fix a false negative for Style/OptionalArguments with singleton methods. (@bbatsov)
  • #15383: Fix a false negative for Style/RedundantFilterChain with numbered-parameter blocks. (@bbatsov)
  • #15290: Fix a false negative for Lint/ToEnumArguments when a braced hash is passed to keyword parameters (e.g. to_enum(:m, { required: required })), which raises ArgumentError when the enumerator is used. (@RedZapdos123)
  • #11956: Fix a false positive for Naming/FileName when a class or module name contains multiple consecutive AllowedAcronyms. (@camallen)
  • #15324: Fix a false positive for Style/DirEmpty with a block. (@bbatsov)
  • #15326: Fix a false positive for Style/EmptyLiteral with numbered and it block parameters. (@bbatsov)
  • #15335: Fix a false positive for Style/EnvHome. (@bbatsov)
  • #15345: Fix a false positive for Style/InlineComment with rubocop:todo directives. (@bbatsov)
  • #15348: Fix a false positive for Style/MultilineIfThen. (@bbatsov)
  • #15383: Fix a false positive for Style/NumericPredicate when an allowed method encloses a numbered-parameter or it block. (@bbatsov)
  • #15389: Fix a false positive for Style/OptionHash when the options hash is forwarded with an explicit super. (@bbatsov)
  • #15350: Fix a false positive for Style/RedundantFormat with a lone format sequence. (@bbatsov)
  • #15374: Fix a false positive for Style/RedundantSelf with a rescue exception variable. (@bbatsov)
  • #15376: Fix a false positive for Style/Semicolon with a semicolon inside a string literal. (@bbatsov)
  • #15398: Fix an incorrect autocorrect for Layout/ConditionPosition that dropped a body statement sharing the condition's line via a semicolon. (@bbatsov)
  • #15399: Fix an incorrect autocorrect for Layout/EmptyComment that deleted a heredoc when removing an empty comment trailing its opener. (@bbatsov)
  • #15400: Fix an incorrect autocorrect for Layout/EmptyLineBetweenDefs that inserted a blank line inside a heredoc body when an endless method's body was a heredoc. (@bbatsov)
  • #15401: Fix an incorrect autocorrect for Layout/SpaceAroundOperators that turned **= and /= compound assignments into **//, dropping the assignment. (@bbatsov)
  • #15406: Fix an incorrect autocorrect for Naming/MemoizedInstanceVariableName. (@bbatsov)
  • #15411: Fix an incorrect autocorrect for Naming/RescuedExceptionsVariableName. (@bbatsov)
  • #15319: Fix an incorrect autocorrect for Style/DataInheritance with a brace block. (@bbatsov)
  • #15323: Fix an incorrect autocorrect for Style/EmptyCaseCondition as a yield/super argument. (@bbatsov)
  • #15323: Fix an incorrect autocorrect for Style/EmptyCaseCondition with low-precedence when values. (@bbatsov)
  • #15322: Fix an incorrect autocorrect for Style/EmptyClassDefinition with a namespaced constant. (@bbatsov)
  • #15336: Fix an incorrect autocorrect for Style/EmptyHeredoc. (@bbatsov)
  • #15332: Fix an incorrect autocorrect for Style/EvenOdd. (@bbatsov)
  • #15329: Fix an incorrect autocorrect for Style/ExactRegexpMatch with a single quote. (@bbatsov)
  • #15333: Fix an incorrect autocorrect for Style/FileNull. (@bbatsov)
  • #15334: Fix an incorrect autocorrect for Style/For. (@bbatsov)
  • #15331: Fix an incorrect autocorrect for Style/FormatString with a low-precedence argument. (@bbatsov)
  • #15331: Fix an incorrect autocorrect for Style/FormatString with a splat argument. (@bbatsov)
  • #15337: Fix an incorrect autocorrect for Style/HashSlice. (@bbatsov)
  • #15327: Fix an incorrect autocorrect for Style/HashSyntax with a multi-pair braceless return. (@bbatsov)
  • #15368: Fix an incorrect autocorrect for Style/IfWithSemicolon that changed semantics when the condition was an assignment, by parenthesizing it in the resulting ternary. (@bbatsov)
  • #15340: Fix an incorrect autocorrect for Style/KeywordArgumentsMerging with a block-pass argument. (@bbatsov)
  • #15387: Fix an incorrect autocorrect for Style/KeywordParametersOrder that inserted a spurious blank line when a keyword optional parameter already trailed the parameters list. (@bbatsov)
  • #15341: Fix an incorrect autocorrect for Style/MapIntoArray with a block-pass argument. (@bbatsov)
  • #15342: Fix an incorrect autocorrect for Style/MethodCallWithoutArgsParentheses with it() in a numbered block. (@bbatsov)
  • #15343: Fix an incorrect autocorrect for Style/MinMaxComparison with unless. (@bbatsov)
  • #15348: Fix an incor...
Read more

RuboCop v1.88.0

Choose a tag to compare

@github-actions github-actions released this 16 Jun 05:10

New features

  • #15166: Add a new Recursive option to Style/MutableConstant. When enabled, the cop checks and freezes mutable literals nested inside arrays and hashes. The option is disabled by default to preserve existing behavior. (@paracycle)

Bug fixes

  • #15220: Fix a bad autocorrect for Lint/RedundantSplatExpansion when splatting an empty literal (e.g. when *[] or rescue *[]), which expanded to invalid or semantically different code. (@bbatsov)
  • #15221: Fix a bad autocorrect for Lint/RegexpAsCondition when the regexp literal is negated (e.g. if !/foo/), which inverted the condition. (@bbatsov)
  • #15242: Fix a bad autocorrect for Lint/SymbolConversion when the receiver is an interpolated string containing an embedded double quote (e.g. "foo#{bar}\"qux".to_sym), which produced a syntax error. (@bbatsov)
  • #15270: Fix a crash for Style/CombinableLoops when a for loop has an empty body, and stop autocorrecting consecutive for loops whose iteration variables differ (which produced code referencing an undefined variable). (@bbatsov)
  • #15272: Fix a crash for Style/ConstantVisibility when a visibility declaration has a numeric literal argument (e.g. private_constant 42). (@bbatsov)
  • #15215: Fix a false negative for Lint/OrderedMagicComments when an encoding magic comment is preceded by a magic comment other than frozen_string_literal (e.g. shareable_constant_value). (@bbatsov)
  • #15228: Fix a false negative for Lint/RedundantWithIndex when the block takes no arguments (e.g. ary.each_with_index { do_something }). (@bbatsov)
  • #15230: Fix a false negative for Lint/RequireRelativeSelfPath when requiring the current file by name with its extension (e.g. require_relative 'foo.rb') and the file path is absolute. (@bbatsov)
  • #15229: Fix a false negative for Lint/SafeNavigationChain when an ordinary method is chained after a parenthesized safe navigation call (e.g. (x&.foo).bar). (@bbatsov)
  • #15225: Fix a false negative for Lint/SafeNavigationWithEmpty when the receiver of &.empty? is a local variable, instance variable, constant, or other non-method-call expression. (@bbatsov)
  • #15231: Fix a false negative for Lint/SendWithMixinArgument when send/public_send/__send__ is called with no explicit receiver or with a self receiver (e.g. send(:include, Bar)). (@bbatsov)
  • #15248: Fix a false negative for Lint/ToEnumArguments when more positional arguments are passed than the method accepts (e.g. def m(x); to_enum(:m, x, extra); end), which raises ArgumentError when the enumerator is used. (@bbatsov)
  • #15249: Fix a false negative for Lint/UnescapedBracketInRegexp when an unescaped ] is preceded by an escaped backslash (e.g. /abc\\]123/). (@bbatsov)
  • #15267: Fix a false positive for Style/ArrayIntersectWithSingleElement with a splat argument (e.g. array.intersect?([*foo])), which is not a single element and was incorrectly rewritten to array.include?(*foo). (@bbatsov)
  • #15272: Fix a false positive for Style/ColonMethodCall with chained JRuby interop calls (e.g. Java::com::something_method). (@bbatsov)
  • #15271: Fix a false positive for Style/ConditionalAssignment with EnforcedStyle: assign_inside_condition when assigning an unless without an else branch (e.g. x = unless cond; 1; end), which was rewritten to move the assignment inside the unless and changed behavior when the condition was true. (@bbatsov)
  • #14401: Fix a false positive for Layout/BlockAlignment with EnforcedStyleAlignWith: start_of_line when a block is passed as a method argument. (@augustocbx)
  • #15216: Fix a false positive for Lint/RaiseException when raise Exception is used inside a module nested within an allowed implicit namespace (e.g. Gem). (@bbatsov)
  • #15219: Fix a false positive for Lint/RedundantDirGlobSort when sort is given a comparator block or a block-pass argument, which is not redundant with the default sorting. (@bbatsov)
  • #15224: Fix a false positive for Lint/ShadowingOuterLocalVariable when a block argument has the same name as a pattern variable from a different in branch of the same case. (@bbatsov)
  • #15239: Fix a false positive for Lint/SuppressedExceptionInNumberConversion when the numeric constructor already passes exception: false (e.g. Integer(arg, exception: false) rescue nil), which also produced an autocorrect with a duplicate exception: false keyword. (@bbatsov)
  • #15243: Fix a false positive for Lint/TopLevelReturnWithArgument when a return with an argument is inside a numbered-parameter block or an it block. (@bbatsov)
  • #15245: Fix a false positive for Lint/UselessRuby2Keywords when ruby2_keywords in a nested class or module refers to a method of the same name defined in an outer scope. (@bbatsov)
  • #15246: Fix a false positive for Lint/UselessSetterCall when a multiple assignment uses nested destructuring (e.g. (a, b), c = arg, other_arg), which misaligned variables with the right-hand side values. (@bbatsov)
  • #15125: Fix a false positive for Style/ZeroLengthPredicate when File::Stat.new(...).size.zero? is used. (@augustocbx)
  • #15196: Fix --start-server to wait until the server is running before returning, which fixes a flaky --restart-server spec and a race for commands run right after starting the server. (@koic)
  • #15272: Fix Style/Alias not detecting block scope for numbered-parameter and it blocks, which caused a false positive for alias_method and a false negative for alias inside such blocks. (@bbatsov)
  • #15281: Fix an incorrect autocorrect when Style/IfUnlessModifier and Style/Next correct the same conditional. (@fynsta)
  • #15260: Fix an error for Style/FileWrite when a literal or variable is passed to write in the block form. (@koic)
  • #15276: Fix an error for Style/RedundantFormat when the format string is a heredoc with format arguments. (@fynsta)
  • #15270: Fix an incorrect autocorrect for Style/AndOr when an operand is next, break, or yield with an argument (e.g. foo and next 1), which produced invalid Ruby like foo && next 1. (@bbatsov)
  • #15267: Fix an incorrect autocorrect for Style/ArrayFirstLast when arr[0]/arr[-1] is the target of a compound assignment (e.g. arr[0] += 1), which produced arr.first += 1 and raised NoMethodError. (@bbatsov)
  • #15267: Fix an incorrect autocorrect for Style/ArrayIntersect where a negated predicate on a safe-navigation chain (e.g. a&.intersection(b)&.none?) was rewritten to !a&.intersect?(b), flipping the result when the receiver is nil. (@bbatsov)
  • #15273: Fix an incorrect autocorrect for Style/BlockDelimiters that converted a single-line do...end block containing a block-level rescue or ensure to {...}, producing invalid Ruby. (@bbatsov)
  • #15268: Fix an incorrect autocorrect for Style/CaseEquality when the argument is an operator or unary expression (e.g. Array === a + b), which produced mis-parsed code like a + b.is_a?(Array). (@bbatsov)
  • #15268: Fix an incorrect autocorrect for `Style/ClassEqualit...
Read more

RuboCop v1.87.0

Choose a tag to compare

@github-actions github-actions released this 30 May 08:52

New features

  • #15167: Add --enable-all-cops and --disable-all-cops command line options that override AllCops/EnabledByDefault and AllCops/DisabledByDefault in configuration files. (@koic)
  • #15185: Make Layout/EmptyLineAfterGuardClause accept the new # simplecov:disable and # simplecov:enable directive comments. (@koic)
  • #15173: Add optional Rubydex integration via AllCops/UseProjectIndex to enable cross-file detection in Lint/ConstantReassignment (experimental). (@koic)

Bug fixes

  • #15168: Fix false positives in Lint/ParenthesesAsGroupedExpression when the first argument is a call-like expression with its own parentheses, such as yield(...). (@koic)
  • #15188: Fix false positives in Style/YodaCondition when one side is an array or hash literal containing non-literal elements. (@koic)
  • #15182: Fix incorrect autocorrect for Style/Alias causing a syntax error when the return value of alias_method is used, such as an argument to public, private, protected, or module_function, or the right-hand side of an assignment. (@koic)
  • #15174: Fix incorrect autocorrect for Style/ClassAndModuleChildren causing a syntax error when the namespace contains a method call (e.g., class self.class::Foo; end). (@koic)
  • #15180: Fix incorrect autocorrect for Style/FileWrite causing a syntax error when the written heredoc is chained with another method call. (@koic)
  • #15186: Fix incorrect autocorrect for Style/HashConversion causing a syntax error when Hash[...] is passed an anonymous splat (*). (@koic)
  • #15192: Fix incorrect autocorrect for Style/StructInheritance causing a syntax error when the inherited Struct.new is called without parentheses. (@koic)
  • #15170: Fix an infinite loop for Layout/RedundantLineBreak when a single-line block is chained with a safe navigation method call. (@koic)
  • #15175: Fix Layout/IndentationWidth to indent block bodies relative to the method selector for trailing-dot multi-line method chains when EnforcedStyleAlignWith is relative_to_receiver. (@ddbrendan)
  • #15135: Fix incorrect autocorrect for Style/RedundantParentheses that swallowed chained method calls into a trailing inline comment on the line above the closing parenthesis. (@hammadxcm)
  • #15184: Fix various typos and grammar mistakes in documentation and cop descriptions. (@bbatsov)

Changes

  • #15171: Cache FilePatterns#match? results per path so cops sharing the same Include/Exclude configuration do not each repeat File.fnmatch? work on every file. (@Darhazer)