brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2021-03-02 05:48:25 +00:00
parent 9e86f14aa3
commit 1397f66bde
54 changed files with 23 additions and 18 deletions

View File

@ -82,7 +82,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.4.1/lib
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.10.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.10.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.10.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.9.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.2.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.5.1/lib"

View File

@ -32,13 +32,15 @@ module RuboCop
TARGET_METHODS = %i[all? any? one? none?].freeze
COMPARISON_METHODS = %i[== === is_a? kind_of?].freeze
IS_A_METHODS = %i[is_a? kind_of?].freeze
def on_block(node)
return unless TARGET_METHODS.include?(node.method_name)
return unless TARGET_METHODS.include?(node.method_name) && node.arguments.one?
block_argument = node.arguments.first
block_body = node.body
return unless use_equality_comparison_block?(block_body)
return if same_block_argument_and_is_a_argument?(block_body, block_argument)
return unless (new_argument = new_argument(block_argument, block_body))
range = offense_range(node)
@ -55,6 +57,12 @@ module RuboCop
block_body.send_type? && COMPARISON_METHODS.include?(block_body.method_name)
end
def same_block_argument_and_is_a_argument?(block_body, block_argument)
return false unless IS_A_METHODS.include?(block_body.method_name)
block_argument.source == block_body.first_argument.source
end
def new_argument(block_argument, block_body)
if block_argument.source == block_body.receiver.source
block_body.first_argument.source

View File

@ -21,32 +21,29 @@ module RuboCop
STR_SPECIAL_CHARS = %w[\n \" \' \\\\ \t \b \f \r].freeze
def_node_matcher :split_call_with_regexp?, <<~PATTERN
{(send !nil? :split {regexp})}
{(send !nil? :split $regexp)}
PATTERN
def on_send(node)
return unless split_call_with_regexp?(node)
return unless determinist_regexp?(node.first_argument)
return unless (regexp_node = split_call_with_regexp?(node))
return if regexp_node.ignore_case?
return unless determinist_regexp?(regexp_node)
add_offense(node.first_argument) do |corrector|
autocorrect(corrector, node)
add_offense(regexp_node) do |corrector|
new_argument = replacement(regexp_node)
corrector.replace(regexp_node, "\"#{new_argument}\"")
end
end
private
def determinist_regexp?(first_argument)
DETERMINISTIC_REGEX.match?(first_argument.source)
def determinist_regexp?(regexp_node)
DETERMINISTIC_REGEX.match?(regexp_node.source)
end
def autocorrect(corrector, node)
new_argument = replacement(node)
corrector.replace(node.first_argument, "\"#{new_argument}\"")
end
def replacement(node)
regexp_content = node.first_argument.content
def replacement(regexp_node)
regexp_content = regexp_node.content
stack = []
chars = regexp_content.chars.each_with_object([]) do |char, strings|
if stack.empty? && char == '\\'

View File

@ -4,7 +4,7 @@ module RuboCop
module Performance
# This module holds the RuboCop Performance version information.
module Version
STRING = '1.10.0'
STRING = '1.10.1'
def self.document_version
STRING.match('\d+\.\d+').to_s