Releases: rubocop/rubocop
Releases · rubocop/rubocop
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)
RuboCop 1.38
New features
- #11110: Add new
Style/RedundantEach
cop. (@koic) - #10255: Add simple autocorrect for
Style/GuardClause
. (@FnControlOption) - #11126: Have
Lint/RedundantRequireStatement
markset
as a redundant require in Ruby 3.2+. (@drenmi) - #11001: Add option to raise cop errors
--raise-cop-error
. (@wildmaples) - #10987: Opt-in cop compatibility in redundant directives. (@tdeo)
Bug fixes
- #11125: Fix an error for
Layout/SpaceInsideHashLiteralBraces
when using method argument that both key and value are hash literals. (@koic) - #11132: Fix clobbering error on
Lint/EmptyConditionalBody
. (@r7kamura) - #11117: Fix a false positive for
Style/BlockDelimiters
when specifyingEnforcedStyle: semantic
and using a single line block with {} followed by a safe navigation method call. (@koic) - #11120: Fix an incorrect autocorrect for
Lint/RedundantRequireStatement
when using redundantrequire
with modifier form. (@koic)
Changes
- #11131: Check newline in empty reference bracket on
Layout/SpaceInsideReferenceBrackets
. (@r7kamura) - #11045: Update the
Style/ModuleFunction
documentation to suggestclass << self
as an alternative. (@rdeckard) - #11006: Allow multiple
elsif
forStyle/IfWithBooleanLiteralBranches
. (@koic) - #11113: Report the count of files in the Worst and the Offense Count formatters. (@hosamaly)
RuboCop 1.37.1
Bug fixes
- #11102: Fix an error for
Style/AccessModifierDeclarations
when using access modifier in a block. (@koic) - #11107: Fix a false positive for
Style/OperatorMethodCall
when a constant receiver uses an operator method. (@koic) - #11104: Fix an error for
Style/CollectionCompact
when usingreject
method and receiver is a variable. (@koic) - #11114: Fix an error for
Style/OperatorMethodCall
when usingobj.!
. (@koic) - #11088: Fix an error when specifying
SuggestExtensions: true
. (@koic) - #11089: Fix an error for
Style/RedundantStringEscape
when using character literals (e.g.?a
). (@ydah) - #11098: Fix false positive for
Style/RedundantStringEscape
. (@tdeo) - #11095: Fix an error for
Style/RedundantStringEscape
cop when using?\n
string character literal. (@koic)
RuboCop 1.37
New features
- #11043: Add new
Lint/DuplicateMagicComment
cop. (@koic) - #10409: Add
--no-exclude-limit
CLI option. (@r7kamura) - #10986: Add autocorrect for
Style/StaticClass
. (@FnControlOption) - #11018: Add
AllowedMethods
andAllowedPatterns
forLint/NestedMethodDefinition
. (@koic) - #11055: Implement
Lint/DuplicateMethods
for object singleton class. (@tdeo) - #10997: Make
rubocop
command aware of--server
option from .rubocop and RUBOCOP_OPTS. (@koic) - #11079: Add new
Style/OperatorMethodCall
cop. (@koic) - #10439: Add new
Style/RedundantStringEscape
cop. (@owst)
Bug fixes
- #11034: Fix server mode behavior when using
--stderr
. (@tdeo) - #11028: Fix a false positive for
Lint/RequireParentheses
when using ternary operator in square bracksts. (@koic) - #11051: Preserve comments on
Style/AccessModifierDeclarations
autocorrection. (@r7kamura) - #9116: Support
super
method inLayout/FirstArgumentIndentation
. (@tdeo) - #11068: Fix a false positive for
Style/RedundantRegexpCharacterClass
when using starting with "\0" number. (@koic) - #11082: Fix an incorrect autocorrect for
Lint/SafeNavigationChain
when safe navigation on the right-hand side of the arithmetic operator. (@ydah) - #10982: Do not autocorrect parentheses for calls in assignments in conditional branches for
Style/MethodCallWithArgsParentheses
withomit_parentheses
. (@gsamokovarov) - #11084: Fix an error for
Style/ParallelAssignment
when using parallel assignment in singleton method. (@koic) - #11078: Fix a false positive for
Style/RedundantBegin
when using endless method definition forbegin
with multiple statements. (@koic) - #11074: Fix a false positive for
Lint/RedundantDirGlobSort
when usingDir.glob
with multiple arguments. (@koic) - #11025: Check comments for disables in
RedundantInitialize
cop. (@HeroProtagonist) - #11003: Fix clobbering exception in EmptyConditionalBody cop when if branch is empty but else is not. (@srcoley)
- #11026: Fix an error occurred for
Style/SymbolArray
andStyle/WordArray
when empty percent array. (@ydah) - #11022: Fix an incorrect autocorrect for
Style/RedundantCondition
when using redundant brackets access condition. (@koic) - #11037: Fix a false positive for
Style/CollectionCompact
when usingto_enum.reject
orlazy.reject
methods with Ruby 3.0 or lower. (@koic) - #11017: Fix an autocorrect for
Lint/EmptyConditionalBody
that causes a SyntaxError when missingif
andelse
body. (@ydah) - #11047: Fix an incorrect autocorrect for
Style/SafeNavigationChain
when using+@
and-@
methods. (@koic) - #11015: Fix a false positive for
Style/HashSyntax
when without parentheses call expr follows after nested method call. (@koic) - #11067: Fix a false positive for
Lint/DuplicateRegexpCharacterClassElement
when using regexp character starts with escaped zero number. (@koic) - #11030: Fix an incorrect autocorrect for
Lint/UnusedMethodArgument
andStyle::ExplicitBlockArgument
when autocorrection conflicts for&block
argument. (@koic) - #11069: Fix an incorrect autocorrect for
Lint/RedundantCopDisableDirective
when disable directive contains free comment. (@koic) - #11063: Preserve comments on
Style/AccessorGrouping
autocorrection. (@r7kamura) - #10994: Fix an error when running 3rd party gem that does not require server. (@koic)
Changes
- #11054: Implement correct behavior for compact mode for
Layout/SpaceInsideArrayLiteralBrackets
. (@tdeo) - #10924:
Style/NegatedIfElseCondition
also checks negative conditions inside parentheses. (@tsugimoto) - #11042: Mark
Lint/OrderedMagicComments
as unsafe autocorrection. (@koic) - #11057: Make
Lint/RedundantRequireStatement
aware ofpp
,ruby2_keywords
, andfiber
. (@koic) - #10988: Raise error when both safe and unsafe autocorrect options are specified. (@koic)
- #11032: Detect empty Hash literal braces containing only newlines and spaces on
Layout/SpaceInsideHashLiteralBraces
. (@r7kamura)
RuboCop 1.36
New features
- #10931: Add
AllowOnSelfClass
option toStyle/CaseEquality
. (@sambostock)
Bug fixes
- #10958: Fix an infinite loop for
Layout/SpaceInsideBlockBraces
whenEnforcedStyle
isno_space
and using multiline block. (@ydah) - #10903: Skip forking off extra processes for parallel inspection when only a single file needs to be inspected. (@wjwh)
- #10919: Fix a huge performance regression between 1.32.0 and 1.33.0. (@ydah)
- #10951: Fix an autocorrection error for
Lint/EmptyConditionalBody
when some conditional branch is empty. (@ydah) - #10927: Fix a false positive for
Style/HashTransformKeys
andStyle/HashTransformValues
when not using transformed block argument. (@koic) - #10979: Fix a false positive for
Style/RedundantParentheses
when using parentheses with pin operator except for variables. (@Tietew) - #10962: Fix a false positive for
Lint/ShadowingOuterLocalVariable
when conditional with if/elsif/else branches. (@ydah) - #10969: Fix a false negative for
AllowedPatterns
ofLint/AmbiguousBlockAssociation
when using a method chain. (@jcalvert) - #10963: Fix a false positive for
Layout/IndentationWidth
when using aligned emptyelse
in pattern matching. (@koic) - #10975: Fix possible wrong autocorrection in namespace on
Style/PerlBackrefs
. (@r7kamura)
Changes
- #10928: Add more autocorrect support on
Style/EachForSimpleLoop
. (@r7kamura) - #10960: Add
as
toAllowedNames
in default configuration forNaming/MethodParameterName
cop. (@koic) - #10966: Add autocorrect support to
Style/AccessModifierDeclarations
. (@r7kamura) - #10940: Add server mode status to
-V
option. (@koic)
RuboCop 1.35.1
Bug fixes
- #10926: Make
Style/SafeNavigation
aware of a redundant nil check. (@koic) - #10944: Fix an incorrect autocorrect for
Lint/LiteralInInterpolation
when using"#{nil}"
. (@koic) - #10921: Fix an error when ERB pre-processing of the configuration file. (@koic)
- #10936: Fix an error for
Lint/NonAtomicFileOperation
when usingFileTest.exist?
as a condition forelsif
. (@koic) - #10920: Fix an incorrect autocorrect for
Style/SoleNestedConditional
when using nested conditional and branch contains a comment. (@koic) - #10939: Fix an error for
Style/Next
when line break before condition. (@koic)
RuboCop 1.35
New features
- #9364: Add
Style/MagicCommentFormat
cop. (@dvandersluis, @mattbearman) - #10776: New option (
consistent
) forEnforcedShorthandSyntax
inStyle/HashSyntax
to avoid mixing shorthand and non-shorthand hash keys in ruby 3.1. (@h-lame)
Bug fixes
- #10899: Fix an error for
Lint/ShadowingOuterLocalVariable
when the same variable name as a block variable is used in return value assignment ofif
. (@koic) - #10916: Fix an error when .rubocop.yml is empty. (@koic)
- #10915: Fix numblock support to
Layout/BlockAlignment
,Layout/BlockEndNewline
,Layout/EmptyLinesAroundAccessModifier
,Layout/EmptyLinesAroundBlockBody
,Layout/IndentationWidth
,Layout/LineLength
,Layout/MultilineBlockLayout
,Layout/SpaceBeforeBlockBraces
,Lint/NextWithoutAccumulator
,Lint/NonDeterministicRequireOrder
,Lint/RedundantWithIndex
,Lint/RedundantWithObject
,Lint/UnreachableLoop
,Lint/UselessAccessModifier
,Lint/Void
,Metrics/AbcSize
,Metrics/CyclomaticComplexity
,Style/CollectionMethods
,Style/CombinableLoops
,Style/EachWithObject
,Style/For
,Style/HashEachMethods
,Style/InverseMethods
,Style/MethodCalledOnDoEndBlock
,Style/MultilineBlockChain
,Style/Next
,Style/ObjectThen
,Style/Proc
,Style/RedundantBegin
,Style/RedundantSelf
,Style/RedundantSortBy
andStyle/TopLevelMethodDefinition
. (@gsamokovarov) - #10895: Fix incorrect autocomplete in
Style/RedundantParentheses
when a heredoc is used in an array. (@dvandersluis) - #10909: Fix loading behavior on running without
bundle exec
. (@r7kamura) - #10913: Make
Style/ArgumentsForwarding
aware of anonymous block argument. (@koic) - #10911: Fix Style/ClassMethodsDefinitions for non-self receivers. (@sambostock)
Changes
- #10915: Depend on rubocop-ast 1.20.1 for numblocks support in #macro?. (@gsamokovarov)
RuboCop 1.34.1
RuboCop 1.34
New features
- #10170: Add new
InternalAffairs/SingleLineComparison
cop. (@dvandersluis)
Bug fixes
- #10552: Require RuboCop AST 1.20.0+ to fix a false positive for
Lint/OutOfRangeRegexpRef
when using fixed-encoding regopt. (@koic) - #10512: Fix a false positive for
Lint/ShadowingOuterLocalVariable
conditional statement and block variable. (@ydah) - #10864:
min
andmax
results in false positives forStyle/SymbolProc
similarly toselect
andreject
. (@mollerhoj) - #10846: Fix a false negative for
Style/DoubleNegation
when there is a hash or an array at return location of method. (@nobuyo) - #10875: Fix an obsolete option configuration values are duplicated when generating
.rubocop_todo.yml
. (@ydah) - #10877: Fix crash with
Layout/BlockEndNewline
heredoc detection. (@dvandersluis) - #10859: Fix
Lint/Debugger
to be able to handle method chains correctly. (@dvandersluis) - #10883: Fix
Style/RedundantParentheses
to be able to detect offenses and properly correct when the end parentheses and comma are on their own line. (@dvandersluis) - #10881: Fix
Style/SoleNestedConditional
to properly wrapblock
andcsend
nodes when necessary. (@dvandersluis) - #10867: Mark autocorrection for
Lint/EmptyConditionalBody
as unsafe. (@dvandersluis) - #10871: Restore
RuboCop::ConfigLoader.project_root
as deprecated. (@koic)
Changes
- #10857: Add
AllowedPatterns
toStyle/NumericLiterals
. (@dvandersluis) - #10648: Allow
Style/TernaryParentheses
to take priority overStyle/RedundantParentheses
when parentheses are enforced. (@dvandersluis) - #10731: Show tip for suggested extensions that are installed but not loaded in .rubocop.yml. (@nobuyo)
- #10845: Support Bundler-like namespaced feature on require config. (@r7kamura)
- #10773: Require Parser 3.1.2.1 or higher. (@dvandersluis)