Merge pull request #8040 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-performance-1.7.1
build(deps): bump rubocop-performance from 1.7.0 to 1.7.1 in /Library/Homebrew
This commit is contained in:
commit
84e4e1b449
@ -92,7 +92,7 @@ GEM
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-ast (0.2.0)
|
||||
parser (>= 2.7.0.1)
|
||||
rubocop-performance (1.7.0)
|
||||
rubocop-performance (1.7.1)
|
||||
rubocop (>= 0.82.0)
|
||||
rubocop-rspec (1.42.0)
|
||||
rubocop (>= 0.87.0)
|
||||
|
||||
@ -62,10 +62,10 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-3.9.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-its-1.3.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-retry-0.6.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-0.1.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-0.2.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.88.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.7.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.7.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.42.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"
|
||||
|
||||
@ -4,6 +4,7 @@ Performance/AncestorsInclude:
|
||||
Description: 'Use `A <= B` instead of `A.ancestors.include?(B)`.'
|
||||
Reference: 'https://github.com/JuanitoFatas/fast-ruby#ancestorsinclude-vs--code'
|
||||
Enabled: 'pending'
|
||||
Safe: false
|
||||
VersionAdded: '1.7'
|
||||
|
||||
Performance/BigDecimalWithNumericArgument:
|
||||
@ -247,6 +248,8 @@ Performance/StartWith:
|
||||
Performance/StringInclude:
|
||||
Description: 'Use `String#include?` instead of a regex match with literal-only pattern.'
|
||||
Enabled: 'pending'
|
||||
AutoCorrect: false
|
||||
SafeAutoCorrect: false
|
||||
VersionAdded: '1.7'
|
||||
|
||||
Performance/StringReplacement:
|
||||
@ -35,7 +35,9 @@ module RuboCop
|
||||
def autocorrect(node)
|
||||
ancestors_include_candidate?(node) do |subclass, superclass|
|
||||
lambda do |corrector|
|
||||
corrector.replace(node, "#{subclass.source} <= #{superclass.source}")
|
||||
subclass_source = subclass ? subclass.source : 'self'
|
||||
|
||||
corrector.replace(node, "#{subclass_source} <= #{superclass.source}")
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -8,14 +8,13 @@ module RuboCop
|
||||
# than from Numeric for BigDecimal.
|
||||
#
|
||||
# @example
|
||||
#
|
||||
# # bad
|
||||
# BigDecimal(1, 2)
|
||||
# BigDecimal(1.2, 3, exception: true)
|
||||
# BigDecimal(1, 2)
|
||||
# BigDecimal(1.2, 3, exception: true)
|
||||
#
|
||||
# # good
|
||||
# BigDecimal('1', 2)
|
||||
# BigDecimal('1.2', 3, exception: true)
|
||||
# BigDecimal('1', 2)
|
||||
# BigDecimal('1.2', 3, exception: true)
|
||||
#
|
||||
class BigDecimalWithNumericArgument < Cop
|
||||
MSG = 'Convert numeric argument to string before passing to `BigDecimal`.'
|
||||
@ -26,6 +25,8 @@ module RuboCop
|
||||
|
||||
def on_send(node)
|
||||
big_decimal_with_numeric_argument?(node) do |numeric|
|
||||
next if numeric.float_type? && specifies_precision?(node)
|
||||
|
||||
add_offense(node, location: numeric.source_range)
|
||||
end
|
||||
end
|
||||
@ -37,6 +38,12 @@ module RuboCop
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def specifies_precision?(node)
|
||||
node.arguments.size > 1 && !node.arguments[1].hash_type?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -6,6 +6,8 @@ module RuboCop
|
||||
# This cop identifies unnecessary use of a regex where
|
||||
# `String#include?` would suffice.
|
||||
#
|
||||
# This cop's offenses are not safe to auto-correct if a receiver is nil.
|
||||
#
|
||||
# @example
|
||||
# # bad
|
||||
# 'abc'.match?(/ab/)
|
||||
@ -3,7 +3,7 @@
|
||||
module RuboCop
|
||||
module Performance
|
||||
module Version
|
||||
STRING = '1.7.0'
|
||||
STRING = '1.7.1'
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user