Skip to content

Releases: rubocop/rubocop

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

RuboCop 1.38

01 Nov 07:27
Compare
Choose a tag to compare

New features

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 specifying EnforcedStyle: 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 redundant require with modifier form. (@koic)

Changes

  • #11131: Check newline in empty reference bracket on Layout/SpaceInsideReferenceBrackets. (@r7kamura)
  • #11045: Update the Style/ModuleFunction documentation to suggest class << self as an alternative. (@rdeckard)
  • #11006: Allow multiple elsif for Style/IfWithBooleanLiteralBranches. (@koic)
  • #11113: Report the count of files in the Worst and the Offense Count formatters. (@hosamaly)

RuboCop 1.37.1

24 Oct 06:35
Compare
Choose a tag to compare

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 using reject method and receiver is a variable. (@koic)
  • #11114: Fix an error for Style/OperatorMethodCall when using obj.!. (@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

20 Oct 07:57
Compare
Choose a tag to compare

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 and AllowedPatterns for Lint/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 in Layout/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 with omit_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 for begin with multiple statements. (@koic)
  • #11074: Fix a false positive for Lint/RedundantDirGlobSort when using Dir.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 and Style/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 using to_enum.reject or lazy.reject methods with Ruby 3.0 or lower. (@koic)
  • #11017: Fix an autocorrect for Lint/EmptyConditionalBody that causes a SyntaxError when missing if and else 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 and Style::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 of pp, ruby2_keywords, and fiber. (@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

01 Sep 08:00
Compare
Choose a tag to compare

New features

Bug fixes

  • #10958: Fix an infinite loop for Layout/SpaceInsideBlockBraces when EnforcedStyle is no_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 and Style/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 of Lint/AmbiguousBlockAssociation when using a method chain. (@jcalvert)
  • #10963: Fix a false positive for Layout/IndentationWidth when using aligned empty else 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 to AllowedNames in default configuration for Naming/MethodParameterName cop. (@koic)
  • #10966: Add autocorrect support to Style/AccessModifierDeclarations. (@r7kamura)
  • #10940: Add server mode status to -V option. (@koic)

RuboCop 1.35.1

22 Aug 05:48
Compare
Choose a tag to compare

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 using FileTest.exist? as a condition for elsif. (@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

12 Aug 12:51
Compare
Choose a tag to compare

New features

  • #9364: Add Style/MagicCommentFormat cop. (@dvandersluis, @mattbearman)
  • #10776: New option (consistent) for EnforcedShorthandSyntax in Style/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 of if. (@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 and Style/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

RuboCop 1.34.1

09 Aug 15:07
Compare
Choose a tag to compare

Bug fixes

  • #10893: Fix an error when running rubocop without bundle exec. (@koic)

RuboCop 1.34

09 Aug 05:27
Compare
Choose a tag to compare

New features

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 and max results in false positives for Style/SymbolProc similarly to select and reject. (@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 wrap block and csend 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 to Style/NumericLiterals. (@dvandersluis)
  • #10648: Allow Style/TernaryParentheses to take priority over Style/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)