Merge pull request #6733 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-performance-1.5.1

build: bump rubocop-performance from 1.5.0 to 1.5.1 in /Library/Homebrew
This commit is contained in:
Mike McQuaid 2019-11-13 10:40:08 -08:00 committed by GitHub
commit 930bbe0b9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 22 additions and 12 deletions

View File

@ -48,7 +48,7 @@ GEM
nokogiri (1.10.5)
mini_portile2 (~> 2.4.0)
ntlm-http (0.1.1)
parallel (1.18.0)
parallel (1.19.0)
parallel_tests (2.29.2)
parallel
parser (2.6.5.0)
@ -87,7 +87,7 @@ GEM
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-performance (1.5.0)
rubocop-performance (1.5.1)
rubocop (>= 0.71.0)
rubocop-rspec (1.36.0)
rubocop (>= 0.68.1)

View File

@ -18,7 +18,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/json-2.2.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/docile-1.3.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.10.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-0.16.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tins-1.21.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tins-1.22.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/term-ansicolor-1.7.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thor-0.20.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/coveralls-0.8.23/lib"
@ -43,7 +43,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ntlm-http-0.1.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/webrobots-0.1.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.7.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mustache-1.1.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.18.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.19.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-2.29.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.6.5.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib"
@ -62,6 +62,6 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/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.6.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.76.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.5.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.5.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.36.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"

View File

@ -51,7 +51,7 @@ module RuboCop
caller_arg = node.receiver.first_argument
n = caller_arg ? int_value(caller_arg) : 1
if node.method_name == :[]
if node.method?(:[])
m = int_value(node.first_argument)
n += m
format(MSG_BRACE, n: n, m: m, method: method_name)

View File

@ -9,8 +9,11 @@ module RuboCop
# @example
# # bad
# 'abc'.match?(/bc\Z/)
# /bc\Z/.match?('abc')
# 'abc' =~ /bc\Z/
# /bc\Z/ =~ 'abc'
# 'abc'.match(/bc\Z/)
# /bc\Z/.match('abc')
#
# # good
# 'abc'.end_with?('bc')
@ -21,7 +24,8 @@ module RuboCop
def_node_matcher :redundant_regex?, <<-PATTERN
{(send $!nil? {:match :=~ :match?} (regexp (str $#literal_at_end?) (regopt)))
(send (regexp (str $#literal_at_end?) (regopt)) {:match :=~} $_)}
(send (regexp (str $#literal_at_end?) (regopt)) {:match :match?} $_)
(match-with-lvasgn (regexp (str $#literal_at_end?) (regopt)) $_)}
PATTERN
def literal_at_end?(regex_str)
@ -36,6 +40,7 @@ module RuboCop
add_offense(node)
end
alias on_match_with_lvasgn on_send
def autocorrect(node)
redundant_regex?(node) do |receiver, regex_str|

View File

@ -128,7 +128,7 @@ module RuboCop
end
def indent_width
@config.for_cop('IndentationWidth')['Width'] || 2
@config.for_cop('Layout/IndentationWidth')['Width'] || 2
end
def max_key_value_pairs

View File

@ -60,7 +60,7 @@ module RuboCop
_, constant = *node.receiver
constant == :Array || node.method_name == :to_a
constant == :Array || node.method?(:to_a)
end
def hash?(node)
@ -69,7 +69,7 @@ module RuboCop
_, constant = *node.receiver
constant == :Hash || node.method_name == :to_h
constant == :Hash || node.method?(:to_h)
end
end
end

View File

@ -9,8 +9,11 @@ module RuboCop
# @example
# # bad
# 'abc'.match?(/\Aab/)
# /\Aab/.match?('abc')
# 'abc' =~ /\Aab/
# /\Aab/ =~ 'abc'
# 'abc'.match(/\Aab/)
# /\Aab/.match('abc')
#
# # good
# 'abc'.start_with?('ab')
@ -21,7 +24,8 @@ module RuboCop
def_node_matcher :redundant_regex?, <<-PATTERN
{(send $!nil? {:match :=~ :match?} (regexp (str $#literal_at_start?) (regopt)))
(send (regexp (str $#literal_at_start?) (regopt)) {:match :=~} $_)}
(send (regexp (str $#literal_at_start?) (regopt)) {:match :match?} $_)
(match-with-lvasgn (regexp (str $#literal_at_start?) (regopt)) $_)}
PATTERN
def literal_at_start?(regex_str)
@ -39,6 +43,7 @@ module RuboCop
add_offense(node)
end
alias on_match_with_lvasgn on_send
def autocorrect(node)
redundant_regex?(node) do |receiver, regex_str|