Skip to content

Releases: rubocop/rubocop

RuboCop 1.52.1

12 Jun 08:03
Compare
Choose a tag to compare

Bug fixes

  • #11944: Fix an incorrect autocorrect for Style/SoleNestedConditional with Style/MethodCallWithArgsParentheses. (@koic)
  • #11930: Fix exception on Lint/InheritException when class definition has non-constant siblings. (@rafaelfranca)
  • #11919: Fix an error for Lint/UselessAssignment when a variable is assigned and unreferenced in for. (@koic)
  • #11928: Fix an incorrect autocorrect for Lint/AmbiguousBlockAssociation. (@koic)
  • #11915: Fix a false positive for Lint/RedundantSafeNavigation when &. is used for to_s, to_i, to_d, and other coercion methods. (@lucthev)

Changes

RuboCop 1.52

02 Jun 09:28
Compare
Choose a tag to compare

New features

  • #11873: Add ComparisonsThreshold config option to Style/MultipleComparison. (@fatkodima)
  • #11886: Add new Style/RedundantArrayConstructor cop. (@koic)
  • #11873: Add new Style/RedundantRegexpConstructor cop. (@koic)
  • #11841: Add new Style/RedundantFilterChain cop. (@fatkodima)
  • #11908: Support AllowedReceivers for Style/CollectionMethods. (@koic)

Bug fixes

  • #11890: Fix a false negative for Lint/RedundantSafeNavigation when &. is used for to_d. (@koic)
  • #11880: Fix a false positive for Style/ExactRegexpMatch when using literal with quantifier in regexp. (@koic)
  • #11902: Fix a false positive for Style/RequireOrder when single-quoted string and double-quoted string are mixed. (@koic)
  • #11879: Fix a false positive for Style/SelectByRegexp when Ruby 2.2 or lower analysis. (@koic)
  • #11891: Fix Style/AccessorGrouping to accept macros separated from accessors by space. (@fatkodima)
  • #11905: Fix an error for Lint/UselessAssignment when a variable is assigned with rest assignment and unreferenced. (@koic)
  • #11899: Fix an incorrect autocorrect for Style/SingleLineMethods when using Ruby 3.0 and Style/EndlessMethod is disabled. (@koic)
  • #11884: Make rubocop -V display rubocop-factory_bot version when using it. (@koic)
  • #11893: Fix a false positive for Lint/InheritException when inheriting Exception with omitted namespace. (@koic)
  • #11898: Fix offences in calls inside blocks with braces for Style/MethodCallWithArgsParentheses with omit_parentheses enforced style. (@gsamokovarov)
  • #11857: Server mode: only read $stdin when -s or --stdin argument provided. (@naveg)

RuboCop 1.51 (The RubyKaigi 2023 Edition)

13 May 07:55
Compare
Choose a tag to compare

New features

  • #11819: Add autocorrection for Lint/AmbiguousBlockAssociation. (@r7kamura)
  • #11597: Add autocorrection for Lint/UselessAssignment. (@r7kamura)
  • #11848: Add autocorrection for Lint/Void. (@r7kamura)
  • #11851: Add autocorrection for Naming/MemoizedInstanceVariableName. (@r7kamura)
  • #11856: Add autocorrection for Style/CombinableLoops. (@r7kamura)
  • #11824: Add autocorrection for Lint/TopLevelReturnWithArgument. (@r7kamura)
  • #11869: Add new Style/ExactRegexpMatch cop. (@koic)
  • #11814: Make Style/CollectionCompact aware of delete_if. (@koic)
  • #11866: Make Style/Semicolon aware of redundant semicolons in string interpolation braces. (@koic)

Bug fixes

  • #11812: Fix a false negative for Style/Attr when using attr and method definitions. (@koic)
  • #11861: Fix a false positive for Layout/SpaceAfterSemicolon when no space between a semicolon and a closing brace of string interpolation. (@koic)
  • #11830: Fix a false positive for Lint/IncompatibleIoSelectWithFiberScheduler. (@koic)
  • #11846: Fix a false positive for Lint/RedundantStringCoercion when using to_s(argument) in puts argument. (@koic)
  • #11865: Fix an error for Naming/ConstantName when assigning a constant from an empty branch of else. (@koic)
  • #11844: Fix a false positive for Style/RedundantLineContinuation when using line concatenation for assigning a return value and without argument parentheses. (@koic)
  • #11808: Fix a false positive for Style/RegexpLiteral when using a regexp starts with equal as a method argument. (@koic)
  • #11822: Fix an error for Layout/SpaceInsideBlockBraces when a method call with a multiline block is used as an argument. (@koic)
  • #11849: Fix an error for Style/ConditionalAssignment when EnforcedStyle: assign_inside_condition and using empty case condition. (@koic)
  • #11967: Fix error for Style/IfInsideElse when a deep nested multiline if...then...elsif...else...end. (@koic)
  • #11842: Fix an error for Style/IfUnlessModifier when using multiple if modifier in the long one line. (@koic)
  • #11835: Fix an error for Style/RequireOrder when multiple require are not sorted. (@koic)
  • #11809: Fix an incorrect autocorrect for Naming/RescuedExceptionsVariableName when exception variable is referenced after rescue statement. (@koic)
  • #11852: Fix an incorrect autocorrect for Style/EvalWithLocation when using eval without line number and with parenthesized method call. (@koic)
  • #11862: Fix an incorrect autocorrect for Style/GuardClause when using raise in else branch in a one-liner with then. (@koic)
  • #11868: Fix a false positive for Style/HashExcept when method's receiver/argument is not the same as block key argument. (@fatkodima)
  • #11858: Fix false positives when using source comments in blocks. (@reitermarkus)
  • #11510: Fix Lint/UselessAssignment false positive when using numbered block parameters. (@sambostock)
  • #11872: Fix Gemspec/DevelopmentDependencies not trigger when add_development_dependency has more then one arguments. (@Bhacaz)
  • #11820: Fix Lint/EmptyConditionalBody false-positives for commented empty elsif body. (@r7kamura)

Changes

  • #11859: Add rubocop-factory_bot to suggested extensions. (@ydah)
  • #11791: (Breaking) Drop runtime support for Ruby 2.6 and JRuby 9.3 (CRuby 2.6 compatible). (@koic)
  • #11826: Exclude **/*.jb from Lint/TopLevelReturnWithArgument. (@r7kamura)
  • #11871: Mark Style/DataInheritance as unsafe autocorrect, Style/OpenStructUse as unsafe, and Security/CompoundHash as unsafe. (@koic)

RuboCop 1.50.2

17 Apr 08:14
Compare
Choose a tag to compare

Bug fixes

  • #11799: Fix a false positive for Style/CollectionCompact when using reject on hash to reject nils in Ruby 2.3 analysis. (@koic)
  • #11792: Fix an error for Lint/DuplicateMatchPattern when using hash pattern with if guard. (@koic)
  • #11800: Mark Style/InvertibleUnlessCondition as unsafe. (@koic)

RuboCop 1.50.1

12 Apr 12:53
Compare
Choose a tag to compare

Bug fixes

  • #11787: Fix a false positive for Lint/DuplicateMatchPattern when repeated in patterns but different if guard is used. (@koic)
  • #11789: Fix false negatives for Style/ParallelAssignment when Ruby 2.7+. (@koic)
  • #11783: Fix a false positive for Style/RedundantLineContinuation using line concatenation for assigning a return value and without argument parentheses. (@koic)

RuboCop 1.50

11 Apr 07:15
Compare
Choose a tag to compare

New features

  • #11749: Add new Lint/DuplicateMatchPattern cop. (@koic)
  • #11773: Make Layout/ClassStructure aware of singleton class. (@koic)
  • #11779: Make Lint/RedundantStringCoercion aware of print method arguments. (@koic)
  • #11776: Make Metrics/ClassLength aware of singleton class. (@koic)
  • #11775: Make Style/TrailingBodyOnClass aware of singleton class. (@koic)

Bug fixes

  • #11758: Fix a false positive for Style/RedundantLineContinuation when line continuations for string. (@koic)
  • #11754: Fix a false positive for Style/RedundantLineContinuation when using && and || with a multiline condition. (@ydah)
  • #11765: Fix an error for Style/MultilineMethodSignature when line break after def keyword. (@koic)
  • #11762: Fix an incorrect autocorrect for Style/ClassEqualityComparison when comparing a variable or return value for equality. (@koic)
  • #11752: Fix a false positive for Style/RedundantLineContinuation when using line concatenation and calling a method without parentheses. (@koic)

RuboCop 1.49

03 Apr 07:09
Compare
Choose a tag to compare

New features

  • #11122: Add new Style/RedundantLineContinuation cop. (@ydah)
  • #11696: Add new Style/DataInheritance cop. (@ktopolski)
  • #11746: Make Layout/EndAlignment aware of pattern matching. (@koic)
  • #11750: Make Metrics/BlockNesting aware of numbered parameter. (@koic)
  • #11699: Make Style/ClassEqualityComparison aware of Class#to_s and Class#inspect for class equality comparison. (@koic)
  • #11737: Make Style/MapToHash and Style/MapToSet aware of numbered parameters. (@koic)
  • #11732: Make Style/MapToHash and Style/MapToSet aware of symbol proc. (@koic)
  • #11703: Make Naming/InclusiveLanguage support autocorrection when there is only one suggestion. (@koic)

Bug fixes

  • #11730: Fix an error for Layout/HashAlignment when using anonymous keyword rest arguments. (@koic)
  • #11704: Fix a false positive for Lint/UselessMethodDefinition when method definition with non access modifier containing only super call. (@koic)
  • #11723: Fix a false positive for Style/IfUnlessModifier when using one-line pattern matching as a if condition. (@koic)
  • #11725: Fix an error when insufficient permissions to server cache dir are granted. (@koic)
  • #11715: Ensure default configuration loads. (@koic)
  • #11742: Fix error handling in bundler standalone mode. (@composerinteralia)
  • #11712: Fix a crash in Lint/EmptyConditionalBody. (@gsamokovarov)
  • #11641: Fix a false negative for Layout/ExtraSpacing when there are many comments with extra spaces. (@nobuyo)
  • #11740: Fix a false positive for Lint/NestedMethodDefinition when nested definition inside *_eval and *_exec method call with a numblock. (@ydah)
  • #11685: Fix incorrect directive comment insertion when percent array violates Layout/LineLength cop. (@nobuyo)
  • #11706: Fix infinite loop when --disable-uncorrectable option and there is a multi-line percent array violates Layout/LineLength. (@nobuyo)
  • #11697: Fix Lint/Syntax behavior when --only is not given the cop name. (@koic)
  • #11709: Fix value omission false positive in Style/MethodCallWithArgsParentheses. (@gsamokovarov)

Changes

  • #11739: Make Style/RedundantParentheses aware of redundant method argument parentheses. (@koic)
  • #10766: Use the path given by --cache-root to be the parent for rubocop_cache dir like other ways to specify it. (@nobuyo)

RuboCop 1.48.1

13 Mar 07:00
Compare
Choose a tag to compare

Bug fixes

  • #11673: Fix incorrect Style/HashSyntax autocorrection for assignment methods. (@gsamokovarov)
  • #11682: Fix a false positive for Lint/UselessRescue when using Thread#raise in rescue clause. (@koic)
  • #11672: Fix an error for Layout/BlockEndNewline when multiline block } is not on its own line and it is used as multiple arguments. (@koic)
  • #11675: Style/AccessorGrouping: Fix sibling detection for methods with type sigs. (@issyl0)
  • #11658: Fix Lint/Debugger should not allow pry. (@ThHareau)
  • #11689: Fix Lint/Syntax behavior when Enabled: false of Lint department. (@koic)
  • #11677: Fix the severity for Lint/Syntax. (@koic)
  • #11691: Fix an error for Gemspec/DependencyVersion when method called on gem name argument for add_dependency. (@koic)

RuboCop 1.48

06 Mar 09:50
Compare
Choose a tag to compare

New features

Bug fixes

  • #11654: Fix a false positive for Lint/MissingSuper when no super call and when defining some method. (@koic)
  • #11661: Fix an error for Style/Documentation when namespace is a variable. (@koic)
  • #11647: Fix an error for Style/IfWithBooleanLiteralBranches when using () as a condition. (@koic)
  • #11646: Fix an error for Style/NegatedIfElseCondition when using () as a condition. (@koic)
  • #11659: Fix an incorrect autocorrect for Lint/OrAssignmentToConstant when using or-assignment to a constant in method definition. (@koic)
  • #11663: Fix an incorrect autocorrect for Style/BlockDelimiters when multi-line blocks to { and } with arithmetic operation method chain. (@koic)
  • #11638: Fix a false positive for Lint/UselessAccessModifier when using same access modifier inside and outside the included block. (@ydah)
  • #11164: Suppress server mode message with -f json. (@jasondoc3)
  • #11643: Fix incorrect shorthand autocorrections in calls inside parentheses. (@gsamokovarov)
  • #11650: Style/AccessorGrouping: Fix detection of Sorbet sig {} blocks. (@issyl0)
  • #11657: Use cop name to check if cop inside registry is enabled. Previously, it was able to cause large memory usage during linting. (@fatkodima)

Changes

  • #11482: Avoid comment deletion by Style/IfUnlessModifier when the modifier form expression has long comment. (@nobuyo)
  • #11649: Support MinBranchesCount config for Style/CaseLikeIf cop. (@fatkodima)

RuboCop 1.47

01 Mar 11:29
Compare
Choose a tag to compare

New features

Bug fixes

  • #11615: Fix a false negative for Lint/MissingSuper when no super call with Class.new block. (@koic)
  • #11615: Fix a false negative for Lint/MissingSuper when using Class.new without parent class argument. (@koic)
  • #11040: Fix a false positive for Style/IfUnlessModifier when defined?'s argument value is undefined. (@koic)
  • #11607: Fix a false positive for Style/RedundantRegexpEscape when an escaped hyphen follows after an escaped opening square bracket within a character class. (@SparLaimor)
  • #11626: Fix a false positive for Style/ZeroLengthPredicate when using File.new(path).size.zero?. (@koic)
  • #11620: Fix an error for Lint/ConstantResolution when using __ENCODING__. (@koic)
  • #11625: Fix an error for Lint/EmptyConditionalBody when missing if body and using method call for return value. (@koic)
  • #11631: Fix an incorrect autocorrect for Style/ArgumentsForwarding when using arguments forwarding for .() call. (@koic)
  • #11621: Fix an incorrect autocorrect for Layout/ClassStructure using heredoc inside method. (@fatkodima)
  • #3591: Handle modifier while and until expressions in Lint/UselessAssignment. (@bfad)
  • #11202: Fixed usage of --only flag with --auto-gen-config. (@istvanfazakas)

Changes

  • #11623: Add rubocop-capybara to suggested extensions and extension doc. (@ydah)