Releases: rubocop/rubocop
Releases · rubocop/rubocop
RuboCop 1.45.1
Bug fixes
- #11552: Fix a false positive for
Lint/Debugger
when methods containing different method chains. (@ydah) - #11548: Fix an error for
Style/AccessModifierDeclarations
when if a non method definition was included. (@ydah) - #11554: Fix an error for
Style/RedundantCondition
when the branches contains empty hash literal argument. (@koic) - #11549: Fix an error for third party cops when inheriting
RuboCop::Cop::Cop
. (@koic)
RuboCop 1.45
New features
- #10839: Add API for 3rd party template support. (@r7kamura)
- #11528: Add new
Style/RedundantHeredocDelimiterQuotes
cop. (@koic) - #11188: Add a
--no-detach
option for--start-server
. This will start the server process in the foreground, which can be helpful when running within Docker where detaching the process terminates the container. (@f1sherman) - #11546: Make
Lint/UselessAccessModifier
aware of Ruby 3.2'sData.define
. (@koic) - #11396: Add ability to profile rubocop execution via
--profile
and--memory
options. (@fatkodima)
Bug fixes
- #11491: Fix a crash on
Lint/UselessAssignment
. (@gsamokovarov) - #11515: Fix a false negative for
Naming/HeredocDelimiterNaming
when using lowercase. (@koic) - #11511: Fix a false negative for
Style/YodaCondition
when using constant. (@koic) - #11520: Fix a false negative for
Style/YodaExpression
when using constant. (@koic) - #11521: Fix a false positive for
Lint/FormatParameterMismatch
when usingKernel.format
with the interpolated number of decimal places fields match. (@koic) - #11545: Fix the following false positive for
Lint/NestedMethodDefinition
when using numbered parameter. (@koic) - #11535: Fix a false positive for
Style/NumberedParametersLimit
when only_2
or higher numbered parameter is used. (@koic) - #11508: Fix a false positive for
Style/OperatorMethodCall
when using multiple arguments for operator method. (@koic) - #11503: Fix a false positive for
Style/RedundantCondition
when using method argument with operator. (@koic) - #11529: Fix an incorrect autocorrect for
Layout/ClassStructure
when definitions that need to be sorted are defined alternately. (@ydah) - #11530: Fix an incorrect autocorrect for
Style/AccessModifierDeclarations
when multiple groupable access modifiers are defined. (@ydah) - #10910: Fix an incorrect autocorrect for
Style/MultilineTernaryOperator
when contains a comment. (@ydah) - #11522: Don't flag default keyword arguments in
Style/ArgumentsForwarding
. (@splattael) - #11547: Fix a false positive for
Lint/NestedMethodDefinition
when using Ruby 3.2'sData.define
. (@koic) - #11537: Fix an infinite loop error for
Layout/ArrayAlignment
when using assigning unbracketed array elements. (@koic) - #11516: Fix missing parentheses in shorthand hash syntax as argument calls. (@gsamokovarov)
Changes
- #11504: Allow
initialize
method inStyle/DocumentationMethod
. (@koic) - #11541: Enable autocorrection for
Layout/LineContinuationLeadingSpace
. (@eugeneius) - #11542: Mark
Layout/AssignmentIndentation
as safe andLint/AssignmentInCondition
as unsafe for autocorrection. (@eugeneius) - #11517: Make
Lint/Debugger
aware ofp
,PP.pp
, andpp
methods. (@koic) - #11539: Remove
bundler
from defaultAllowedGems
ofGemspec/DevelopmentDependencies
. (@koic)
RuboCop 1.44.1
Bug fixes
- #11492: Fix an error for
Lint/Void
when configuringCheckForMethodsWithNoSideEffects: true
. (@koic) - #11400: Fix an incorrect autocorrect for
Naming/BlockForwarding
andLint/AmbiguousOperator
when autocorrection conflicts for ambiguous splat argument. (@fatkodima) - #11483: Fix
Layout/ClosingParenthesisIndentation
for keyword splat arguments. (@fatkodima) - #11487: Fix a false positive for
Lint/FormatParameterMismatch
when format string is only interpolated string. (@ydah) - #11485: Fix a false positive for
Lint/UselessAssignment
when using numbered block parameter. (@koic)
RuboCop 1.44
New features
- #11410: Add new
Style/InvertibleUnlessCondition
cop. (@fatkodima) - #11338: Add new
Style/ComparableClamp
cop. (@koic) - #11350: Make
Lint/DeprecatedClassMethods
aware of deprecatedattr
with boolean 2nd argument. (@koic) - #11457: Make
Metrics/BlockNesting
aware of pattern matching. (@koic) - #11458: Make
Metrics/CyclomaticComplexity
aware of pattern matching. (@koic) - #11469: Add
Gemspec/DevelopmentDependencies
cop. (@sambostock)
Bug fixes
- #11445: Fix an incorrect autocorrect for
Style/BlockDelimiters
when there is a comment after the closing brace and bracket. (@koic) - #11428: Apply value omission exceptions in super invocations. (@gsamokovarov)
- #11420: Fix a false positive for
Lint/UselessRescue
when using exception variable inensure
clause. (@koic) - #11460: Fix an error for
Style/OperatorMethodCall
when usingfoo.> 42
. (@koic) - #11456: Fix value omissions in
yield
invocations. (@gsamokovarov) - #11467: Fix a false negative for
Style/MethodCallWithoutArgsParentheses
when calling method on a receiver and assigning to a variable with the same name. (@koic) - #11430: Fix an infinite loop error for
Layout/BlockEndNewline
when multiline blocks with newlines before the; end
. (@koic) - #11442: Fix a crash during anonymous rest argument forwarding. (@gsamokovarov)
- #11447: Fix an incorrect autocorrect for
Style/RedundantDoubleSplatHashBraces
when using nested double splat hash braces. (@koic) - #11459: Make
Lint/UselessRuby2Keywords
aware of conditions. (@splattael) - #11415: Fix a false positive for
Lint/UselessMethodDefinition
when method definition contains rest arguments. (@koic) - #11418: Fix a false positive for
Style/MethodCallWithArgsParentheses
when using anonymous rest arguments or anonymous keyword rest arguments. (@koic) - #11431: Fix a crash in Style/HashSyntax. (@gsamokovarov)
- #11444: Fix a false positive for
Lint/ShadowingOuterLocalVariable
when using numbered block parameter. (@koic) - #11477: Fix an error when using YAML alias with server mode. (@koic)
- #11419: Fix a false positive for
Style/RedundantRequireStatement
when usingpretty_inspect
. (@koic) - #11439: Fix an incorrect autocorrect for
Style/MinMaxComparison
when usinga < b a : b
withelsif/else
. (@ydah) - #11464: Fix a false negative for
Lint/FormatParameterMismatch
when include interpolated string. (@ydah) - #11425: Fix a false negative for
Lint/Void
when using methods that takes blocks. (@krishanbhasin-shopify) - #11437: Fix an error for
Style/AccessModifierDeclarations
when access modifier is inlined with a method on the top level. (@koic) - #11455: Fix crash with
super value_omission:
followed by a method call. (@gsamokovarov)
Changes
RuboCop 1.43
New features
- #11359: Add new
Lint/UselessRescue
cop. (@fatkodima) - #11389: Add autocorrect for
Style/MissingElse
. (@FnControlOption)
Bug fixes
- #11386: Fix a false positive for
Style/OperatorMethodCall
when using anonymous forwarding. (@koic) - #11409: Fix an incorrect autocorrect for
Style/HashSyntax
when using hash value omission andEnforcedStyle: no_mixed_keys
. (@koic) - #11405: Fix undefined method `range_between' for Style/WhileUntilModifier. (@such)
- #11374: Fix an error for
Style/StringHashKeys
when using invalid symbol in encoding UTF-8 as keys. (@koic) - #11392: Fix an incorrect autocorrect for
Style/RedundantDoubleSplatHashBraces
using double splat in double splat hash braces. (@koic) - #8990: Make
Style/HashEachMethods
aware of built-inThread.current
. (@koic) - #11390: Fix an incorrect autocorrect for
Style/HashSyntax
when hash first argument key and hash value only are the same which has a method call on the next line. (@koic) - #11379: Fix a false negative for
Style/OperatorMethodCall
when usinga.+ b.something
. (@koic) - #11180: Fix an error for
Style/RedundantRegexpEscape
when using%r
to provide regexp expressions. (@si-lens) - #11403: Fix bad offense for parenthesised calls in literals for
omit_parentheses
style inStyle/MethodCallWithArgsParentheses
. (@gsamokovarov) - #11407: Fix an error for
Style/HashSyntax
when expression follows hash key assignment. (@fatkodima) - #11377: Fix
Style/OperatorMethodCall
when forwarding arguments. (@sambostock)
Changes
RuboCop 1.42
New features
- #11339: Add new
Style/MapToSet
cop. (@koic) - #11341: Add new
Style/MinMaxComparison
cop. (@koic) - #9222: Add new
Style/YodaExpression
cop. (@fatkodima) - #11261: Allow inherit_from to accept a glob. (@alexevanczuk)
Bug fixes
- #11204: Fix a false negative for
Lint/RedundantCopDisableDirective
when using--except
command line option. (@koic) - #11369: Fix an error for
Lint/UselessRuby2Keywords
when usingProc#ruby2_keywords
. (@koic) - #11351: Fix an incorrect autocorrect for
Lint/RegexpAsCondition
when using regexp literal with bang. (@koic) - #11329: Accept simple freezed constants in
Layout/ClassStructure
and correctly handle class methods. (@fatkodima) - #11344: Fix an error for
Style/GuardClause
when using heredoc as an argument of raise inthen
branch and it does not haveelse
branch. (@koic) - #11335: Fix an error for
Style/RequireOrder
when only onereuqire
. (@koic) - #11348: Fix an error for
Style/SelectByRegexp
when block body is empty. (@koic) - #11320: Fix a false positive for
Lint/RequireParentheses
when assigning ternary operator. (@koic) - #11361: Make
Style/MethodDefParentheses
aware of Ruby 3.2's anonymous rest and keyword rest arguments. (@koic) - #11346: Fix a false positive for
Style/RedundantStringEscape
when using escaped space in heredoc. (@koic) - #10858: Fix
Style/IdenticalConditionalBranches
to ignore identical leading lines when branch has single child and is used in return context. (@fatkodima) - #11237: Fix
Layout/CommentIndentation
comment aligned with access modifier indentation when EnforcedStyle is outdent. (@soroktree) - #11330: Fix an error for
Style/RequireOrder
when usingrequire
insiderescue
body. (@fatkodima) - #8751: Accept
super
within ranges forLayout/SpaceAroundKeyword
cop. (@fatkodima) - #10194: Accept bracketed arrays within 2d arrays containing subarrays with complex content for
Style/WordArray
cop. (@fatkodima)
Changes
- #8366: Ignore private constants in
Layout/ClassStructure
cop. (@fatkodima) - #11325: Support autocorrection for percent literals in
Style/ConcatArrayLiterals
. (@fatkodima) - #11327: Make
Style/ZeroLengthPredicate
aware ofarray.length.zero?
. (@koic) - #10976: Support pattern matching for
Lint/OutOfRangeRegexpRef
cop. (@fatkodima)
RuboCop 1.41.1
Bug fixes
- #11293: Fix a false negative for
Style/Documentation
when using macro. (@koic) - #11313: Fix a false positive for
Naming/BlockForwarding
when the block argument is reassigned. (@fatkodima) - #11014: Fix a false positive for
Style/Alias
cop when alias in a method def. (@ydah) - #11309: Fix a false positive for
Style/RedundantStringEscape
when using a redundant escaped string interpolation\#\{foo}
. (@koic) - #11307: Fix an error for
Style/GuardClause
when using lvar as an argument of raise inelse
branch. (@ydah) - #11308: Fix disabling departments via comment. (@fatkodima)
Changes
RuboCop 1.41
New features
- #11305: Add new
Style/RedundantDoubleSplatHashBraces
cop. (@koic) - #10812: New AllowMultilineFinalElement option for all LineBreaks cops. (@Korri)
- #11277: Add new
Style/ConcatArrayLiterals
cop. (@koic)
Bug fixes
- #11255: Fix an error for
Style/RequireOrder
whenrequire
with no arguments is put betweenrequire
. (@ydah) - #11273: Fix a false positive for
Lint/DuplicateMethods
when there are samealias_method
name outsiderescue
orensure
scopes. (@koic) - #11267: Fix an error for Style/RequireOrder when modifier conditional is used between
require
. (@ydah) - #11254: Fix an error for
Style/RequireOrder
whenrequire
is a method argument. (@koic) - #11266: Fix a false positive for
Style/RedundantConstantBase
when enablingLint/ConstantResolution
. (@koic) - #11296: Fix an error for
Lint/NonAtomicFileOperation
when use file existence checks line breakunless
by postfix before creating file. (@koic) - #11284: Fix an incorrect autocorrect for
Style/WordArray
when assigning%w()
array. (@koic) - #11299: Fix
base_dir
inTargetFinder#find_files()
. (@dukaev) - #11250: Fix an error for
Style/GuardClause
when a method call whose last argument is not a string is in the condition body. (@ydah) - #11298: Fix
Lint/SafeNavigationChain
to correctly handle[]
operator followed by save navigation and method chain. (@fatkodima) - #11256: Fix an incorrect autocorrect for
Style/HashSyntax
when without parentheses call expr follows after multiple keyword arguments method call. (@koic) - #11289: Correctly detect Rails version when using only parts of the framework, instead of the "rails" gem. (@bdewater)
- #11262: Fix an error for
Style/IfUnlessModifier
when the body is a method call with hash splat. (@fatkodima) - #11281: Fix
NoMethodError
forStyle/Documentation
when a class nested under non-constant values. (@arika)
Changes
RuboCop 1.40
New features
- #11179: Add
Style/RedundantConstantBase
cop. (@r7kamura) - #11205: Add
--[no-]auto-gen-enforced-style
CLI option. (@ydah) - #11235: Add
Style/RequireOrder
cop. (@r7kamura) - #11219: Make
Style/SelectByRegexp
aware of!~
method. (@koic) - #11224: Add new cop
Style/ArrayIntersect
which replaces(array1 & array2).any?
witharray1.intersect?(array2)
, methodArray#intersect?
was added in ruby 3.1. (@KirIgor) - #11211: Add autocorrect for
Lint/AssignmentInCondition
. (@r7kamura)
Bug fixes
- #5251: Fix loading of configuration in multi-file edge case. (@NobodysNightmare)
- #11192: Fix a false positive for
Lint/ParenthesesAsGroupedExpression
when using a block argument. (@ydah) - #11143: Fix RedundantCopDisableDirective errors when encountering several department comments. (@isarcasm)
- #11230: Fix an incorrect autocorrect for
Lint/SafeNavigationChain
when using safe navigation with[]
operator followed by method chain. (@koic) - #11181: Fix pattern to match .tool-versions files that specify multiple runtimes. (@noelblaschke)
- #11239: Fix an incorrect autocorrect for
Style/GuardClause
when using heredoc as an argument of raise in branch body. (@koic) - #11182: Fix an incorrect autocorrect for
EnforcedShorthandSyntax: always
ofStyle/HashSyntax
withStyle/IfUnlessModifier
when using Ruby 3.1. (@koic) - #11184: Fix an error for
Lint/ShadowingOuterLocalVariable
when a block local variable has same name as an outeruntil
scope variable. (@koic) - #11198: Fix an error for
Lint/EmptyConditionalBody
when one using line if/;/end without then boby. (@koic) - #11196: Fix a false positive for
Style/GuardClause
when usingraise
inthen
body ofif..elsif..end
form. (@koic) - #11213: Support redundant department disable in scope of
Lint/RedundantCopDisableDirective
cop. (@isarcasm) - #11200: Fix an incorrect autocorrect for
Layout/MultilineMethodCallBraceLayout
when using method chain for heredoc argument in multiline literal brace layout. (@koic) - #11190: Fix an error for
Style/IfWithSemicolon
when using one line if/;/end without then boby. (@koic) - #11244: Fix a false negative for
Style/RedundantReturn
when dynamic define methods. (@ydah)
Changes
- #11218: Update severity of
Bundler/DuplicatedGem
,Bundler/InsecureProtocolSource
,Gemspec/DeprecatedAttributeAssignment
,Gemspec/DuplicatedAssignment
,Gemspec/RequireMFA
,Gemspec/RequiredRubyVersion
, andGemspec/RubyVersionGlobalsUsage
cops to warning. (@koic) - #11222: Make
Style/RedundantArgument
aware ofArray#sum
. (@koic) - #11070: Add ability to count method calls as one line to code length related
Metric
cops. (@fatkodima) - #11226: Make
Lint/Void
aware of used lambda and proc in void context. (@koic) - #11206: Change
Lint/InterpolationCheck
fromSafe: false
toSafeAutoCorrect: false
. (@r7kamura) - #11212: Make
Lint/DeprecatedConstants
aware of deprecatedStruct::Group
andStruct::Passwd
classes. (@koic) - #11236: Remove
respond_to
from default value ofAllowedMethods
forStyle/SymbolProc
. (@koic) - #11185: Make
Style/HashSyntax
aware of without parentheses call expr follows. (@koic) - #11203: Support multiple arguments on
Lint/SendWithMixinArgument
. (@r7kamura) - #11229: Add
cc
toAllowedNames
ofMethodParameterName
cop. (@tjschuck) - #11116: Handle ternaries in
Style/SafeNavigation
. (@fatkodima)
RuboCop 1.39
New features
- #11091: Add autocorrect for
Layout/LineContinuationLeadingSpace
. (@FnControlOption)
Bug fixes
- #11150: Improve
Style/RedundantRegexpEscape
to catch unnecessarily escaped hyphens within a character class. (@si-lens) - #11168: Fix an incorrect autocorrect for
Style/ClassEqualityComparison
when using instance variable comparison in module. (@koic) - #11176: Fix a false positive cases for
Lint/DuplicateMethods
when using duplicate nested method. (@koic) - #11164: Suppress "RuboCop server starting..." message with
--server --format json
. (@koic) - #11156: Fix
Style/OperatorMethodCall
autocorrection when operators are chained. (@gsamokovarov) - #11139: Fix a false negative for
Style/HashEachMethods
when using each with a symbol proc argument. (@ydah) - #11161: Fix a false positive for
Style/HashAsLastArrayItem
when using double splat operator. (@koic) - #11151: Fix a false positive for
Lint/SuppressedException
. (@akihikodaki) - #11123: Fix autocorrection bug for
Style/StringLiterals
when using multiple escape characters. (@si-lens) - #11165: Fix a false positive for
Style/RedundantEach
when any method is used between methods containingeach
in the method name. (@koic) - #11177: Fix a false positive for
Style/ObjectThen
cop with TargetRubyVersion < 2.6. (@epaew) - #11173: Fix an incorrect autocorrect for
Style/CollectionCompact
when usingreject
with block pass arg and no parentheses. (@koic) - #11137: Fix a false positive for
Style/RedundantEach
when using a symbol proc argument. (@ydah) - #11142: Fix
Style/RedundantEach
for non-chainedeach_
calls. (@fatkodima)
Changes
- #11130: Check blank percent literal by
Layout/SpaceInsidePercentLiteralDelimiters
. (@r7kamura) - #11163: Mark
Style/HashExcept
as unsafe. (@r7kamura) - #11171: Support inline visibility definition on checking visibility. (@r7kamura)
- #11158: Add
if
to allowed names list for MethodParameterName. (@okuramasafumi)