Skip to content

Releases: rubocop/rubocop

RuboCop 1.45.1

08 Feb 17:38
Compare
Choose a tag to compare

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

08 Feb 12:30
Compare
Choose a tag to compare

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's Data.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 using Kernel.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's Data.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 in Style/DocumentationMethod. (@koic)
  • #11541: Enable autocorrection for Layout/LineContinuationLeadingSpace. (@eugeneius)
  • #11542: Mark Layout/AssignmentIndentation as safe and Lint/AssignmentInCondition as unsafe for autocorrection. (@eugeneius)
  • #11517: Make Lint/Debugger aware of p, PP.pp, and pp methods. (@koic)
  • #11539: Remove bundler from default AllowedGems of Gemspec/DevelopmentDependencies. (@koic)

RuboCop 1.44.1

25 Jan 12:36
Compare
Choose a tag to compare

Bug fixes

  • #11492: Fix an error for Lint/Void when configuring CheckForMethodsWithNoSideEffects: true. (@koic)
  • #11400: Fix an incorrect autocorrect for Naming/BlockForwarding and Lint/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

23 Jan 10:47
Compare
Choose a tag to compare

New features

  • #11410: Add new Style/InvertibleUnlessCondition cop. (@fatkodima)
  • #11338: Add new Style/ComparableClamp cop. (@koic)
  • #11350: Make Lint/DeprecatedClassMethods aware of deprecated attr 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 in ensure clause. (@koic)
  • #11460: Fix an error for Style/OperatorMethodCall when using foo.> 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 using pretty_inspect. (@koic)
  • #11439: Fix an incorrect autocorrect for Style/MinMaxComparison when using a < b a : b with elsif/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

  • #11465: Make Style/Semicolon aware of redundant semicolon in block. (@koic)
  • #11471: Change to not output not configured warning when renamed and pending cop. (@ydah)

RuboCop 1.43

10 Jan 10:35
Compare
Choose a tag to compare

New features

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 and EnforcedStyle: 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-in Thread.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 using a.+ 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 in Style/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

  • #11382: Require unicode-display_width 2.4.0 or higher. (@fatkodima)
  • #11381: Require Parser 3.2.0.0 or higher. (@koic)
  • #11380: Disable Style/YodaExpression by default. (@koic)
  • #11303: Make Metrics/ParameterLists aware of Struct.new and Data.define blocks. (@koic)

RuboCop 1.42

01 Jan 14:17
Compare
Choose a tag to compare

New features

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 using Proc#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 in then branch and it does not have else branch. (@koic)
  • #11335: Fix an error for Style/RequireOrder when only one reuqire. (@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 using require inside rescue body. (@fatkodima)
  • #8751: Accept super within ranges for Layout/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 of array.length.zero?. (@koic)
  • #10976: Support pattern matching for Lint/OutOfRangeRegexpRef cop. (@fatkodima)

RuboCop 1.41.1

22 Dec 08:42
Compare
Choose a tag to compare

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/Aliascop 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 in else branch. (@ydah)
  • #11308: Fix disabling departments via comment. (@fatkodima)

Changes

  • #11312: Mark Style/ConcatArrayLiterals as unsafe. (@koic)

RuboCop 1.41

20 Dec 08:42
Compare
Choose a tag to compare

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 when require with no arguments is put between require. (@ydah)
  • #11273: Fix a false positive for Lint/DuplicateMethods when there are same alias_method name outside rescue or ensure scopes. (@koic)
  • #11267: Fix an error for Style/RequireOrder when modifier conditional is used between require. (@ydah)
  • #11254: Fix an error for Style/RequireOrder when require is a method argument. (@koic)
  • #11266: Fix a false positive for Style/RedundantConstantBase when enabling Lint/ConstantResolution. (@koic)
  • #11296: Fix an error for Lint/NonAtomicFileOperation when use file existence checks line break unless by postfix before creating file. (@koic)
  • #11284: Fix an incorrect autocorrect for Style/WordArray when assigning %w() array. (@koic)
  • #11299: Fix base_dir in TargetFinder#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 for Style/Documentation when a class nested under non-constant values. (@arika)

Changes

  • #11306: Make Style/IfWithSemicolon aware of one line without else body. (@koic)

RuboCop 1.40

08 Dec 07:53
Compare
Choose a tag to compare

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? with array1.intersect?(array2), method Array#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 of Style/HashSyntax with Style/IfUnlessModifier when using Ruby 3.1. (@koic)
  • #11184: Fix an error for Lint/ShadowingOuterLocalVariable when a block local variable has same name as an outer until 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 using raise in then body of if..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, and Gemspec/RubyVersionGlobalsUsage cops to warning. (@koic)
  • #11222: Make Style/RedundantArgument aware of Array#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 from Safe: false to SafeAutoCorrect: false. (@r7kamura)
  • #11212: Make Lint/DeprecatedConstants aware of deprecated Struct::Group and Struct::Passwd classes. (@koic)
  • #11236: Remove respond_to from default value of AllowedMethods for Style/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 to AllowedNames of MethodParameterName cop. (@tjschuck)
  • #11116: Handle ternaries in Style/SafeNavigation. (@fatkodima)

RuboCop 1.39

14 Nov 06:12
Compare
Choose a tag to compare

New features

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 containing each 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 using reject 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-chained each_ calls. (@fatkodima)

Changes