Releases: rubocop/rubocop
Releases · rubocop/rubocop
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)
RuboCop v1.81.6
Bug fixes
- #14587: Fix an error for
Lint/SelfAssignmentwhen using[]=assignment with no arguments. (@koic) - #14572: Fix an error for
Style/ArrayIntersectwhenintersection(other).any?is called without a receiver. (@koic) - #14599: Fix a crash when
Style/ConditionalAssignmentis configured withassign_inside_conditionaland the conditional contains a multi-line regex. (@martinemde) - #14574: Fix false positives for
Style/RedundantInterpolationwhen using a one-line=>pattern matching. (@koic) - #14602: Fix false positives for
Style/EndlessMethodwhen heredoc is used in method body. (@koic) - #14594: Fix false positives for
Style/EndlessMethodwhen the endless method would exceed the maximum line length. (@koic) - #14605: Fix false positive for
Lint/EmptyInterpolationwhen interpolation is inside a%Wliteral. (@dvandersluis) - #14604: Fix
Style/RedundantFormatfalse positive when a interpolated value is given to a specifier with a width or precision. (@dvandersluis) - #14607: Fix
Style/RedundantFormathandling control characters like\n. (@dvandersluis) - #14577: Fix an incorrect autocorrect for
Style/Semicolonwhen a method call using hash value omission without parentheses is terminated with a semicolon. (@koic) - #14552: Fix a false positive for
Security/JSONLoadwhencreate_additionsis explicitly specified. (@earlopain)
Changes
- #14566: Enhance
Lint::ConstantOverwrittenInRescuecop to detect offenses within fully qualified constants. (@viralpraxis) - #14575: Enhance
Lint/ConstantOverwrittenInRescuecop to detect offenses within nested constants. (@viralpraxis) - #14596: Change
Lint/ConstantOverwrittenInRescueto detect any constant assignment. (@viralpraxis) - #14568: Make
Style/LambdaCallautocorrection contextual. (@koic)
RuboCop v1.81.1
Bug fixes
- #14563: Fix incorrect autocorrection for
Lint/DeprecatedOpenSSLConstantwhenCipherappears twice. (@koic)
Changes
- #14565: Allow multiline method chain for
Style/NumberedParametersandStyle/ItBlockParameterwithEnforcedStyle: allow_single_linewhen the block itself is on a single line. (@earlopain)
RuboCop v1.81.0
New features
- #14512: Add
Style/ArrayIntersectWithSingleElementcop. (@r7kamura) - #10971: Support
EnforcedStyleForMultiline: diff_commainStyle/TrailingCommaInArguments. (@akouryy)
Bug fixes
- #14560: Fix an error for
Style/NilComparisoncop when using thevar.==(nil)andvar.===(nil)syntax. (@viralpraxis) - #14535: Fix autocorrect for
Style/ExplicitBlockArgumentwhen there are two methods that share the same implementation. (@earlopain) - #14527: Fix false negatives for
Style/NumberedParametersandStyle/ItBlockParameterwhen using multiline method chain withEnforcedStyle: allow_single_line. (@koic) - #14522: Fix false negatives for
Layout/MultilineOperationIndentationwhen using indented code on LHS of equality operator in modifier method definition. (@koic) - #14496: Fix false negatives for
Layout/EmptyLineBetweenDefsforAllowAdjacentOneLineDefs: falseandDefLikeMacrosthat take no block. (@earlopain) - #14553: Fix false positives when
EnforcedStyle: allowed_in_returnsand!!appears across multiple lines in return position. (@koic) - #14557: Fix false positives for
Style/RedundantParentheseswhen parentheses are used around a one-linerescueexpression as a condition. (@koic) - #14525: Fix false positives for
Style/RedundantRegexpEscapewhen an escaped variable sigil follows#(e.g.,/#\@foo/,/#\@@bar/,/#\$baz/). (@koic) - #14529: Fix false negative in
Layout/RescueEnsureAlignmentwith a block whose send node is split over multiple lines. (@dvandersluis) - #14528: Fix
Style/RedundantFormatwhen the format string has a variable width that isn't given as a literal value. (@dvandersluis) - #14541: Fix gemspec parsing error when
ParserEngine: parser_prismis configured in a base config file. (@sudoremo) - #14544: Fix an incorrect autocorrect for
Lint/Voidwhen using a return value in assignment method definition. (@koic) - #14543: Fix an incorrect autocorrect for
Style/RedundantRegexpArgumentwhen using escaped single quote character. (@koic) - #14540: Fix an incorrect autocorrect for
Style/UnlessElsewhen usingunlesswiththen. (@koic) - #14507: Fix the built-in Ruby LSP add-on not restarting when config files (
.rubocop.yml,.rubocop_todo.yml) change. (@earlopain) - #14514: Fix the built-in Ruby LSP add-on not respecting
.rubocopconfig file. (@earlopain) - #14508: Fix the built-in Ruby LSP add-on getting in an irrecoverable state when the config is invalid on startup. (@earlopain)
- #14534: Prevent
Layout/LineLengthautocorrection from splitting a block if its receiver contains a heredoc. (@dvandersluis) - #14497: Fix a false positive for
Lint/ShadowedArgumentwhen assigning inside arescueblock. (@earlopain)
Changes
RuboCop v1.80.2
Bug fixes
- #14477: Fix a false positive for
Style/SafeNavigationwhen using ternary expression with index access call with method chain. (@koic) - #14486: Fix false positives for
Style/RedundantParentheseswith unary operators andyield,super, ordefined?. (@earlopain) - #14489: Fix false negatives for
Style/RedundantParentheseswith method calls taking argument without parentheses likereturn (x y) if z. (@earlopain) - #14499: Fix wrong autocorrect for
Style/StringConcatenationwhen a double-quoted string contains escaped quotes and interpolation. (@earlopain) - #14502: Fix wrong autocorrect for
Style/StringConcatenationwhen a single-quoted string contains interpolation like'#{foo}'. (@earlopain)
Changes
RuboCop v1.80.1
Bug fixes
- #14479: Don't invalidate cache when
--display-timeoption is used on the CLI. (@lovro-bikic) - #14473: Fix a false negative for
Style/RedundantBeginusingbeginwith multiple statements withoutrescueorensure. (@koic) - #14475: Fix cop errors during autocorrect for the build in LSP when analyzing as Ruby 3.4. (@earlopain)
Changes
- #14474: Fix false negative for
Layout/EndAlignmentwhenendis not on a separate line. (@lovro-bikic)