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:
commit
930bbe0b9c
@ -48,7 +48,7 @@ GEM
|
|||||||
nokogiri (1.10.5)
|
nokogiri (1.10.5)
|
||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
ntlm-http (0.1.1)
|
ntlm-http (0.1.1)
|
||||||
parallel (1.18.0)
|
parallel (1.19.0)
|
||||||
parallel_tests (2.29.2)
|
parallel_tests (2.29.2)
|
||||||
parallel
|
parallel
|
||||||
parser (2.6.5.0)
|
parser (2.6.5.0)
|
||||||
@ -87,7 +87,7 @@ GEM
|
|||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 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 (>= 0.71.0)
|
||||||
rubocop-rspec (1.36.0)
|
rubocop-rspec (1.36.0)
|
||||||
rubocop (>= 0.68.1)
|
rubocop (>= 0.68.1)
|
||||||
|
|||||||
@ -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/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-html-0.10.2/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-0.16.1/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/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/thor-0.20.3/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/coveralls-0.8.23/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/webrobots-0.1.2/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.7.6/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/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/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/parser-2.6.5.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.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/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/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-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/rubocop-rspec-1.36.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"
|
||||||
|
|||||||
@ -51,7 +51,7 @@ module RuboCop
|
|||||||
caller_arg = node.receiver.first_argument
|
caller_arg = node.receiver.first_argument
|
||||||
n = caller_arg ? int_value(caller_arg) : 1
|
n = caller_arg ? int_value(caller_arg) : 1
|
||||||
|
|
||||||
if node.method_name == :[]
|
if node.method?(:[])
|
||||||
m = int_value(node.first_argument)
|
m = int_value(node.first_argument)
|
||||||
n += m
|
n += m
|
||||||
format(MSG_BRACE, n: n, m: m, method: method_name)
|
format(MSG_BRACE, n: n, m: m, method: method_name)
|
||||||
@ -9,8 +9,11 @@ module RuboCop
|
|||||||
# @example
|
# @example
|
||||||
# # bad
|
# # bad
|
||||||
# 'abc'.match?(/bc\Z/)
|
# 'abc'.match?(/bc\Z/)
|
||||||
|
# /bc\Z/.match?('abc')
|
||||||
# 'abc' =~ /bc\Z/
|
# 'abc' =~ /bc\Z/
|
||||||
|
# /bc\Z/ =~ 'abc'
|
||||||
# 'abc'.match(/bc\Z/)
|
# 'abc'.match(/bc\Z/)
|
||||||
|
# /bc\Z/.match('abc')
|
||||||
#
|
#
|
||||||
# # good
|
# # good
|
||||||
# 'abc'.end_with?('bc')
|
# 'abc'.end_with?('bc')
|
||||||
@ -21,7 +24,8 @@ module RuboCop
|
|||||||
|
|
||||||
def_node_matcher :redundant_regex?, <<-PATTERN
|
def_node_matcher :redundant_regex?, <<-PATTERN
|
||||||
{(send $!nil? {:match :=~ :match?} (regexp (str $#literal_at_end?) (regopt)))
|
{(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
|
PATTERN
|
||||||
|
|
||||||
def literal_at_end?(regex_str)
|
def literal_at_end?(regex_str)
|
||||||
@ -36,6 +40,7 @@ module RuboCop
|
|||||||
|
|
||||||
add_offense(node)
|
add_offense(node)
|
||||||
end
|
end
|
||||||
|
alias on_match_with_lvasgn on_send
|
||||||
|
|
||||||
def autocorrect(node)
|
def autocorrect(node)
|
||||||
redundant_regex?(node) do |receiver, regex_str|
|
redundant_regex?(node) do |receiver, regex_str|
|
||||||
@ -128,7 +128,7 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
|
|
||||||
def indent_width
|
def indent_width
|
||||||
@config.for_cop('IndentationWidth')['Width'] || 2
|
@config.for_cop('Layout/IndentationWidth')['Width'] || 2
|
||||||
end
|
end
|
||||||
|
|
||||||
def max_key_value_pairs
|
def max_key_value_pairs
|
||||||
@ -60,7 +60,7 @@ module RuboCop
|
|||||||
|
|
||||||
_, constant = *node.receiver
|
_, constant = *node.receiver
|
||||||
|
|
||||||
constant == :Array || node.method_name == :to_a
|
constant == :Array || node.method?(:to_a)
|
||||||
end
|
end
|
||||||
|
|
||||||
def hash?(node)
|
def hash?(node)
|
||||||
@ -69,7 +69,7 @@ module RuboCop
|
|||||||
|
|
||||||
_, constant = *node.receiver
|
_, constant = *node.receiver
|
||||||
|
|
||||||
constant == :Hash || node.method_name == :to_h
|
constant == :Hash || node.method?(:to_h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -9,8 +9,11 @@ module RuboCop
|
|||||||
# @example
|
# @example
|
||||||
# # bad
|
# # bad
|
||||||
# 'abc'.match?(/\Aab/)
|
# 'abc'.match?(/\Aab/)
|
||||||
|
# /\Aab/.match?('abc')
|
||||||
# 'abc' =~ /\Aab/
|
# 'abc' =~ /\Aab/
|
||||||
|
# /\Aab/ =~ 'abc'
|
||||||
# 'abc'.match(/\Aab/)
|
# 'abc'.match(/\Aab/)
|
||||||
|
# /\Aab/.match('abc')
|
||||||
#
|
#
|
||||||
# # good
|
# # good
|
||||||
# 'abc'.start_with?('ab')
|
# 'abc'.start_with?('ab')
|
||||||
@ -21,7 +24,8 @@ module RuboCop
|
|||||||
|
|
||||||
def_node_matcher :redundant_regex?, <<-PATTERN
|
def_node_matcher :redundant_regex?, <<-PATTERN
|
||||||
{(send $!nil? {:match :=~ :match?} (regexp (str $#literal_at_start?) (regopt)))
|
{(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
|
PATTERN
|
||||||
|
|
||||||
def literal_at_start?(regex_str)
|
def literal_at_start?(regex_str)
|
||||||
@ -39,6 +43,7 @@ module RuboCop
|
|||||||
|
|
||||||
add_offense(node)
|
add_offense(node)
|
||||||
end
|
end
|
||||||
|
alias on_match_with_lvasgn on_send
|
||||||
|
|
||||||
def autocorrect(node)
|
def autocorrect(node)
|
||||||
redundant_regex?(node) do |receiver, regex_str|
|
redundant_regex?(node) do |receiver, regex_str|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
module RuboCop
|
module RuboCop
|
||||||
module Performance
|
module Performance
|
||||||
module Version
|
module Version
|
||||||
STRING = '1.5.0'
|
STRING = '1.5.1'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user