Releases: rubocop/rubocop
Releases · rubocop/rubocop
RuboCop v1.86.1
Bug fixes
- #11051: Fix
Style/AccessModifierDeclarationsinline autocorrect dropping comments between the access modifier and the following method definition. (@dduugg) - #14665: Cache plugin integration in CopHelper to avoid repeated loading. (@55728)
- #15091: Fix
Lint/DuplicateMethodsfalse positives for anonymous classes in constant assignments and method return values. (@eugeneius) - #15055: Fix
Lint/DuplicateMethodsfalse positives with anonymous classes inside blocks (e.g. RSpeclet,describe). (@ShkumbinDelija) - #15035: Exclude
included_modulesfromStyle/ModuleMemberExistenceCheck. (@koic) - #15087: Fix false positive for
Style/RedundantLineContinuationwhen using interpolated string literals. (@koic) - #14361: Fix false positive in
file_to_include?when a relativeIncludepattern matches a parent directory name in the absolute file path. (@jonas054) - #15090: Fix false positives for
Layout/EmptyLineAfterGuardClausewhen consecutive guard clauses useand return. (@eugeneius) - #15070: Fix false positive for
Lint/RedundantSafeNavigationwhen chained safe navigation is used in a conditional expression withInferNonNilReceiverenabled. (@koic) - #15074: Fix false positives in
Style/RedundantParentheseswhen using parentheses around an endless range in assignment. (@koic) - #15048: Fix issue where the url_for is missing for Cops without instance methods. (@Fryguy)
- #15051: Fix
Style/RedundantParentheseshandling of beginless ranges. (@oggy) - #14980: Fix
Lint/Syntaxzero-length diagnostic range for syntax errors at EOF. (@55728) - #15084: Handle heredocs with methods calls correctly when fixing guard clauses. (@G-Rath)
- #11398: Fix incorrect
Includepath adjustment when local config overrides an inheritedInclude. (@jonas054) - #15092: Fix
Layout/EndAlignmentcop error on an emptybegin. (@viralpraxis) - #15059: Fix an error in
Layout/LineLengthwhenSplitStringsoption is enabled and__FILE__is used. (@jeromedalbert) - #5876: Fix
Lint/UnusedMethodArgumentfalse positive when block argument is used viayield. (@dduugg) - #15093: Return tool execution errors instead of protocol errors in MCP server. (@koic)
Changes
RuboCop v1.86.0
New features
- #15000: Display ZJIT usage when running under LSP. (@koic)
- #14961: Add
AllowedParentClassesoption toStyle/EmptyClassDefinition. (@hammadkhan) - #14977: Support
AllowedReceiversforStyle/HashLookupMethod. (@koic)
Bug fixes
- #15015: Fix
Style/ConcatArrayLiteralsautocorrect deleting code for percent literals with interpolation. (@bbatsov) - #14897: Detect constant reassignment after class/module definition in
Lint/ConstantReassignment. (@ydakuka) - #11829: Fix false negatives for
Lint/DuplicateMethodswhen duplicate methods are defined in anonymous classes and modules not assigned to a constant. (@Darhazer) - #14988: Fix false negative in
Style/RedundantParentheseswhen redundant parentheses around range literals in block body. (@koic) - #14916: Fix false positive for
Layout/MultilineMethodCallIndentationwhen method chain is inside a hash pair value passed to a multiline chained method call. (@ydakuka) - #15010: Fix a false positive for
Lint/DuplicateMethodswhen modules blocks are passed as method arguments. (@5hun-s) - #15028: Fix a false positive for
Lint/DuplicateMethodswhen the same method is defined in different anonymous module blocks passed to a no-receiver call (e.g.stub_const). (@Darhazer) - #15021: Fix false positives in
Layout/EmptyLineAfterGuardClausewhen using a guard clause followed by a multi-line guard clause withraise,fail,return,break, ornext. (@koic) - #15001: Fix false positives in
Layout/RedundantLineBreakwhen settingInspectBlocks: trueand usingrescueorensurein the block. (@koic) - #14997: Fix false positives in
Style/FileOpenwhen assigningFile.opento an instance variable, class variable, global variable, or constant. (@koic) - #15019: Fix false positives in
Lint/DuplicateMethodswhen the same method is defined in anonymous module blocks passed to different receivers. (@koic) - #14987: Complete ERB and Haml autocorrection in a single run. (@alpaca-tc)
- #15039: Fix incorrect autocorrect in
Style/IfWithSemicolonwhenreturnwith value is in theelsebranch. (@koic) - #14930: Fix incorrect autocorrection for
Style/IfUnlessModifierwhen multipleif/unlessmodifier forms are on the same line inside a collection. (@ydakuka) - #14985: Fix incorrect autocorrection in
Lint/SafeNavigationChainwhen chaining a method call after safe navigation in the if branch of a ternary. (@koic) - #15009: Fix infinite loop in
Layout/EndAlignmentwhenendis followed by||or&&. (@koic) - #14981: Fix spurious warning "does not support
Safe/SafeAutoCorrectparameter" when those parameters are set for cops that don't have them in their default configuration. (@dduugg) - #15043: Fix an error for
Lint/UselessDefaultValueArgumentwhenfetchwithout a receiver is inside afetchblock. (@koic) - #15034: Fix incorrect autocorrection in
Style/IfWithSemicolonwhen using single-lineunless/;/end. (@koic) - #15015: Fix
Style/NonNilCheckautocorrect for receivers containing spaces. (@bbatsov) - #15015: Fix
Style/RaiseArgsto allow anonymous keyword forwarding (raise Ex.new(**)). (@bbatsov) - #14890: Fix a false positive for
Lint/RedundantCopDisableDirectivewhen arubocop:disablecomment is used to suppressLint/EmptyWhen,Lint/EmptyConditionalBody,Lint/EmptyInPattern, orStyle/SymbolProc. (@eugeneius) - #15015: Fix false negative in
Style/RedundantPercentQfor%qstrings with interpolation-like syntax. (@bbatsov) - #14984: Fix
Style/AndOradding unnecessary parentheses aroundreturnwithout arguments. (@eugeneius) - #14945: Support files with multiple modifiers in
Lint/UselessConstantScoping. (@h-lame) - #15015: Fix
Style/TrailingMethodEndStatementto detect singleton methods (def self.foo). (@bbatsov) - #10822: Don't store results in cache if there are warnings. (@jonas054)
Changes
RuboCop v1.85.1
Bug fixes
- #14958: Fix false positives in
Style/FileOpenwhenFile.openis passed as an argument or returned from a method. (@sferik) - #14973: Fix
Style/ReduceToHashfalse positive when accumulator is read in key/value. (@sferik) - #14964: Fix false positives in
Style/RedundantParentheseswhen parenthesizing a range in a block body. (@koic)
Changes
- #14969: Autoload formatters; they're required only when actually used. (@lovro-bikic)
RuboCop v1.85.0
New features
- #14921: Add
mise.tomlas source for TargetRubyVersion. (@kitsane) - #14925: Add new
Lint/UnreachablePatternBranchcop. (@sferik) - #14942: Add new
Style/FileOpencop. (@sferik) - #14939: Add new
Style/MapJoincop. (@sferik) - #14924: Add new
Style/OneClassPerFilecop. (@sferik) - #14923: Add new
Style/PartitionInsteadOfDoubleSelectcop. (@sferik) - #14811: Add new
Style/PredicateWithKindcop. (@sferik) - #14938: Add new
Style/ReduceToHashcop. (@sferik) - #14812: Add new
Style/RedundantMinMaxBycop. (@sferik) - #13501: Add new
Style/RedundantStructKeywordInitcop. (@koic) - #14808: Add new
Style/SelectByKindcop. (@sferik) - #14810: Add new
Style/SelectByRangecop. (@sferik) - #14922: Add new
Style/TallyMethodcop. (@sferik) - #14773: Add new
Lint/DataDefineOverridecop. (@bbatsov) - #14781: Add new
InternalAffairs/ItblockHandlercop. (@bbatsov) - #14911: Support built-in MCP server (experimental). (@koic)
Bug fixes
- #14829: Allow classes without a superclass in
Style/EmptyClassDefinition. (@koic) - #14873: Fix an error in
Style/NegatedWhilewhen the last expression of anuntilcondition is negated. (@koic) - #14827: Improve
Style/EmptyClassDefinitionmessage wording. (@bbatsov) - #14800: Fix false obsolete configuration error for extracted cops when loaded as plugins. (@bbatsov)
- #14928: Fix a false positive for
Lint/Voidwhennilis used incasebranch. (@5hun-s) - #14857: Fix false positives in
Style/IfUnlessModifierwhen modifier forms are used inside string interpolations. (@koic) - #8773: Fix false positives in
Style/HashTransformKeysandStyle/HashTransformValues. (@sferik) - #6963: Fix false positives in
Lint/Voidforeachblocks where the return value may be meaningful (e.g.,Enumerator#each). (@sferik) - #14931: Ignore directive comments inside comments. (@koic)
- #14834: Fix
Layout/IndentationWidthfalse positive for chained method blocks whenEnforcedStyleAlignWithisstart_of_line. (@krororo) - #14756: Fix
Lint/Voidto detect void expressions incase/whenbranches. (@bbatsov) - #14874: Fix a
Parser::ClobberingErrorinLint/UselessAssignmentwhen autocorrecting a useless assignment that wraps a block containing another useless assignment. (@koic) - #14880: Fix a false negative in
Layout/MultilineAssignmentLayoutwhen usingnumblockoritblockwithSupportedTypes: ['block']. (@bbatsov) - #11462: Fix over-indentation when autocorrecting nested hashes with
Layout/FirstHashElementIndentation. (@ydakuka) - #14880: Recognize block on different line from left side of multi-line assignment in
Layout/MultilineAssignmentLayout. (@sanfrecce-osaka) - #14641: Fix false positive in
Lint/RedundantSafeNavigationwhen using&.respond_to?with methods defined onObject(e.g.,:class). (@bbatsov) - #14098: Mark
Lint/SafeNavigationConsistencyautocorrect as unsafe. (@bbatsov) - #14791: Fix autocorrect producing
SyntaxErrorinLint/InterpolationCheckwhen single quoted string contains double quotes with invalid interpolation. (@ydakuka)
Changes
- #14872: Tweak autocorrection in
Style/HashAsLastArrayItemwhen multiline hash elements. (@koic) - #14917: Change
Style/EndlessMethodcop to consider receivers. (@fatkodima) - #14851: Reduce precision in 'Finished in X.X seconds' message to 5 decimal places. (@ZimbiX)
- #14895: Rename
class_definitiontoclass_keywordinEnforcedStyleofStyle/EmptyClassDefinition. (@koic) - #14956: Add support for
String.newwith interpolated strings toStyle/RedundantInterpolationUnfreeze. (@lovro-bikic) - #14955: Register redundant parentheses around block body in
Style/RedundantParentheses. (@lovro-bikic)
RuboCop v1.84.2
Bug fixes
- #14854: Fix a clobbering error in
Style/BlockDelimiterswhen autocorrecting nested multi-line blocks with adjacent curly braces. (@koic) - #14837: Fix an error for
Style/IfUnlessModifierwhen the first value uses a normalifand the others use modifierif. (@koic) - #14858: Fix an infinite loop error in
Layout/FirstArgumentIndentationwhen first arguments are over-indented in nested method calls. (@koic) - #14843: Fix an error in
Layout/MultilineMethodCallIndentationwhen a multiline method call follows a hash access. (@koic) - #14859: Fix an error in
Layout/MultilineMethodCallIndentationwhen a multiline method call includes a keyword argument whose value is a method call with a block. (@koic) - #14839: Fix a false positive for
Layout/EmptyLinesAfterModuleInclusionwhenincludeis nested inside an array. (@eugeneius) - #7436: Fix
Style/FormatStringTokento not autocorrect strings outside of format method context in aggressive mode. (@ydakuka) - #14841: Fix false negatives in
Style/HashAsLastArrayItemwhen an array contains only a single hash element. (@koic) - #14865: Fix false negatives in
Style/MethodDefParentheseswhen using splat or forwarding arguments without parentheses. (@koic) - #14833: Fix false positive for
Layout/MultilineMethodCallIndentationwhen a multi-dot method chain is inside a hash pair value. (@ydakuka) - #14847: Fix false positive for
Layout/MultilineMethodCallIndentationwhen a method is chained after a single-line block. (@ydakuka) - #14867: Fix
Offense#highlighted_areaforPseudoSourceRangelocations. (@rafaelfranca) - #14861: Fix an error in
Style/IfUnlessModifierwhen the first value uses a normalifand the others use ternary operator. (@koic) - #14816: Use toplevel cache configs for remote configuration files. (@nekketsuuu)
RuboCop v1.84.1
Bug fixes
- #14803: Fix an error for
Layout/IndentationWidthcop. (@viralpraxis) - #14806: Fix an error in
Style/NegativeArrayIndexwhen usingselfas array with implicitselfreceiver. (@koic) - #14813: Fix opt-in cop comments taking precedence over configuration file exclude patterns. (@afrase)
- #14819: Fix incorrect autocorrect for
Style/GuardClausewhen using heredoc as an argument of method call in raise inelsebranch. (@koic) - #14805: Bring back the original indentation from before version 1.84.0. (@Magikdidi24)
- #12754: Fix an infinite loop for
Style/IfUnlessModifierwhen multipleif/unlessstatements share the same line in arrays, method arguments, or hash values. (@ydakuka) - #14817: Fix an infinite loop between
Layout/FirstArgumentIndentationandLayout/LineLengthwhen correcting method chains. (@ydakuka) - #11513: Fix
Layout/MultilineMethodCallIndentationto properly handle method chains inside hash pair values. (@ydakuka) - #14814: Fix push/pop directives to properly handle nested scopes and state restoration. (@Magikdidi24)
Changes
RuboCop v1.84.0
New features
- #14516: Add
AllowImplicitArrayLiteralstoLayout/FirstArrayElementLineBreak. (@koic) - #14750: Add new
Style/ReverseFindcop. (@koic) - #12343: Add new
Style/EmptyClassDefinitioncop to enforce consistent style for empty class definitions. The cop can enforce either a two-line class definition orClass.newfor classes with no body. (@ydakuka) - #14769: Add new
Style/HashLookupMethodcop to enforceHash#[]vsHash#fetchpreference. (@sferik) - #12051: Add new
Style/NegativeArrayIndexcop to enforce using negative array indices instead of calculating array length minus a value. The cop handles both simple index patterns and range patterns, and recognizes preserving methods and their combinations. (@ydakuka) - #14633: Make a new system to handle push and pop locally. (@Magikdidi24)
- #14722: Support
TargetRubyVersion 4.1(experimental). (@koic)
Bug fixes
- #14697: Allow non-method calls in
CategoriesforLayout/ClassStructure. (@fatkodima) - #14784: Fix an error for
Style/GuardClausewhen using heredoc as an argument of raise inelsebranch andifbranch is empty. (@koic) - #14790: Fix an error for
Style/HashLookupMethodcop when there's no receiver. (@viralpraxis) - #14779: Fix autocorrect crash with
ruby_extractorwhen usingoffset: 0and different source buffers. (@ydakuka) - #14762: Fix false negatives for
Style/RedundantConditionwhen the branches contains constant assignment. (@koic) - #14751: Fix
--force-default-confignot preventing project config loading when used with options that access configuration. (@sakuro) - #14783: Fix incorrect autocorrect for
Style/HashSyntaxwhen shorthand syntax is used in condition ofif/unless/while/until. (@ydakuka) - #14747: Fix a regression in
Layout/IndentationWidthby adding a newEnforcedStyleAlignWithstyle parameter. (@MikeMcQuaid) - #14716: Fix an infinite loop error for
Layout/LineLengthwhenSplitStringsoption is enabled and strings span multiple lines. (@HariprasanthMSH) - #14763: Fix an infinite loop error for
Layout/IndentationWidthandLayout/IndentationConsistencywhen usingEnforcedStyle: indented_internal_methodswith method chain blocks. (@ydakuka) - #9373: Fix an infinite loop error for
Layout/IndentationWidthwhen autocorrecting mixed tabs and spaces in blocks. Fix an infinite loop error forLayout/DefEndAlignmentandLayout/IndentationStylewhen autocorrecting mixed tabs and spaces. Autocorrection for tabs is disabled inAlignmentCorrectorfor indentation offenses, but enabled foralign_end. (@ydakuka) - #12295: Fix
Layout/FirstArgumentIndentationto correct entire method calls and chains for nested calls. (@ydakuka) - #12527: Fix
Offense#highlighted_areato return a validParser::Source::Range. (@ydakuka) - #14801: Preserve source tabs in Clang and Tap formatters when displaying offense highlight. (@lovro-bikic)
- #14761: Improved the remote configuration file name on the cache location. (@Jack12816)
- #14778: Fix a false positive for
Security/JSONLoadwhencreate_additionsoption is passed with other options in a hash. (@wktk) - #14796: Handle logical and operator assignment nodes in variable branch handling. (@lovro-bikic)
Changes
- #14753: Add support for
squishandsquish!applied to heredoc toLayout/HeredocIndentation. (@lovro-bikic) - #14798: Recognize
Forwardablemethods inLint/DuplicateMethods. (@lovro-bikic) - #14793: Make
Lint/RedundantSplatExpansionaware of constant assignment. (@koic) - #14770: Make
Style/AccessModifierDeclarationsaware of self class. (@koic) - #14748: Add support for other
Modulemember existence methods toStyle/ModuleMemberExistenceCheck. (@lovro-bikic) - #14795: Add
AllowedMethodsconfiguration toStyle/ModuleMemberExistenceCheck. (@lovro-bikic)
RuboCop v1.82.1
Bug fixes
- #14736: Fix an error for
Style/TrailingCommaInArgumentswhenEnforcedStyleForMultilineisconsistent_commaand keyword arguments use a trailing comma. (@koic) - #14737: Fix crash in
Layout/RedundantLineBreakwhenLayout/LineLengthis disabled. (@ydakuka) - #14719: Fix crash on long lines when
Layout/LineLengthis disabled. (@floriandejonckheere) - #14743: Fix false positives for
Layout/MultilineMethodCallIndentationwhen multiline method chain with block has expected indent width and the method is preceded by splat or double splat. (@koic) - #12297: Fix false negative in
Layout/IndentationWidthfor multiline method chain blocks. (@rscq) - #14730: Fix the cache implementation to use consistent cache keys across workers. (@byroot)
- #14559: Fix false positives for
Lint/UselessAssignmentwhen a variable is assigned in loop body and used in loop condition. (@ydakuka)
RuboCop v1.82.0
New features
- #14655: Add
AllowRBSInlineAnnotationoption toLayout/LineLength. (@koic) - #14569: Add
IncludedMacroPatternsconfiguration option toStyle/MethodCallWithArgsParenthesesfor pattern-based macro method enforcement. (@mmenanno) - #14670: Add new cop
Style/ModuleMemberExistenceCheck. (@lovro-bikic) - #14644: Support
TargetRubyVersion 4.0(experimental). (@koic)
Bug fixes
- #14649: Fix an error for
Lint/LiteralAsConditionwhen there are literals in multiple branches. (@viralpraxis) - #14678: Fix an error when running deprecated
rake rubocop:auto_correcttask. (@koic) - #14650: Fix wrong autocorrect for
Lint/RedundantSplatExpansionwhen splatting a single literal. (@earlopain) - #14703: Fix false negatives for
Layout/RescueEnsureAlignmentwhen using self class definition. (@koic) - #14706: Fix false negatives for
Lint/NoReturnInBeginEndBlockswhen assigning instance variable, class variable, global variable, or constant. (@koic) - #14715: Fix false positives for
Layout/EmptyLineAfterGuardClausewhen a guard clause follows a multiline heredoc in a parenthesized method call. (@koic) - #14667: Fix false positives for
Layout/EndAlignmentwhen a conditional assignment is used on the same line and theendwith a safe navigation method call is aligned. (@koic) - #14688: Fix false positives for
Layout/EndAlignmentwhen a conditional assignment is used on the same line and theendwith a numbered block oritblock method call is aligned. (@koic) - #14699: Fix false positives for
Lint/RedundantSafeNavigationwhen the receiver is used outside the singleton method definition scope. (@koic) - #14663: Fix false positives for
Style/EndlessMethodwhen multiline or xstring heredoc is used in method body. (@koic) - #10173: Fix false positives for
Style/TrailingCommaInArgumentswhenEnforcedStyleForMultilineis set toconsistent_commaand a multiline braced hash argument appears after another argument. (@koic) - #14680: Handle all
OptionParsererrors when runningrubocopwith input that causes an error. (@dvandersluis) - #14658: Fix incorrect behavior when
Layout/LineLengthis disabled. (@koic) - #14704: Fix incorrect Position character value in LSP. (@tmtm)
- #14619: Store remote configuration caches in cache root. (@Jack12816)
- #14476: Fix
Style/ClassAndModuleChildrento skip compact style definitions inside another class or module whenEnforcedStyle: nested. (@rscq) - #14281: Update
Layout/EndAlignmentwithEnforcedStyleAlignWith: variableto handle conditionals insidebeginnodes properly. (@dvandersluis)
Changes
- #14662: Add autocorrection for
Lint/UselessOr. (@r7kamura) - #14668: Exclude
Severityfrom configuration parameters. (@r7kamura) - #14684: Make
Style/CaseEqualityallow regexp case equality where the receiver is a regexp literal. (@koic) - #14645: Change
Lint/CircularArgumentReferenceto detect offenses within long assignment chains. (@viralpraxis) - #14642: Make
Gemspec/RubyVersionGlobalsUsageaware ofRuby::VERSION. (@koic) - #14695: Make
Layout/EmptyLineAfterMagicCommentaware of# rbs_inlinemagic comment. (@koic) - #10147: Make
Lint/ElseLayoutallow a single-lineelsebody inthensingle-line conditional. (@koic) - #14661: Make
Lint/RedundantRequireStatementaware ofpathnamewhen analyzing Ruby 4.0. (@koic) - #14698: Make
Lint/UnreachableCodeaware of singleton method redefinition. (@koic) - #14677: Make
Style/RedundantArgumentaware ofto_i. (@koic) - #14660: Rename
IgnoreCopDirectivestoAllowCopDirectivesinLayout/LineLength. (@koic) - #14492: Revert #14492, which added support for LSP positionEncoding 'utf-8' and 'utf-32' due to critical performance regression reports. (@koic)
RuboCop v1.81.7
Bug fixes
- #14597: Fix an infinite loop error for
Layout/HashAlignmentwhenEnforcedStyle: with_fixed_indentationis specified forLayout/ArgumentAlignment. (@koic) - #14621: Fix an error for
Naming/PredicateMethodwhen using aninpattern with empty parentheses body. (@koic) - #14631: Fix an error for
Style/SoleNestedConditionalwhen using nested single lineif. (@koic) - #14626: Fix false positives in
Style/ConstantVisibilitywhen visibility is declared with multiple constants. (@koic) - #14628: Fix false positives for
Style/FloatDivisionwhen usingRegexp.last_matchor nth reference (e.g.,$1). (@koic) - #14617: Handle non-specific issues with the Gemfile to allow fallback. (@Fryguy)
- #14622: Fix an error for
Naming/MethodNamewhen the first argument toaliascontains interpolation. (@earlopain)