Merge pull request #11879 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-performance-1.11.5

build(deps): bump rubocop-performance from 1.11.4 to 1.11.5 in /Library/Homebrew
This commit is contained in:
Nanda H Krishna 2021-08-19 00:01:25 +05:30 committed by GitHub
commit 8d2811ea71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 22 additions and 6 deletions

View File

@ -123,7 +123,7 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.10.0) rubocop-ast (1.10.0)
parser (>= 3.0.1.1) parser (>= 3.0.1.1)
rubocop-performance (1.11.4) rubocop-performance (1.11.5)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0) rubocop-ast (>= 0.4.0)
rubocop-rails (2.11.3) rubocop-rails (2.11.3)

View File

@ -464,6 +464,7 @@ class RuboCop::Cop::Performance::RedundantEqualityComparisonBlock < ::RuboCop::C
def offense_range(node); end def offense_range(node); end
def one_block_argument?(block_arguments); end def one_block_argument?(block_arguments); end
def same_block_argument_and_is_a_argument?(block_body, block_argument); end def same_block_argument_and_is_a_argument?(block_body, block_argument); end
def use_block_argument_in_method_argument_of_operand?(block_argument, operand); end
def use_equality_comparison_block?(block_body); end def use_equality_comparison_block?(block_body); end
end end

View File

@ -82,7 +82,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.10.0/li
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11.0/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/unicode-display_width-2.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.19.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.19.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.4/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.5/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.11.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.11.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.4.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"

View File

@ -66,7 +66,7 @@ module RuboCop
chained_method = compact_node.parent chained_method = compact_node.parent
compact_method_range = compact_node.loc.selector compact_method_range = compact_node.loc.selector
if compact_node.multiline? && chained_method&.loc.respond_to?(:selector) && if compact_node.multiline? && chained_method&.loc.respond_to?(:selector) && chained_method.dot? &&
!invoke_method_after_map_compact_on_same_line?(compact_node, chained_method) !invoke_method_after_map_compact_on_same_line?(compact_node, chained_method)
compact_method_range = range_by_whole_lines(compact_method_range, include_final_newline: true) compact_method_range = range_by_whole_lines(compact_method_range, include_final_newline: true)
else else

View File

@ -74,12 +74,27 @@ module RuboCop
def new_argument(block_argument, block_body) def new_argument(block_argument, block_body)
if block_argument.source == block_body.receiver.source if block_argument.source == block_body.receiver.source
block_body.first_argument.source rhs = block_body.first_argument
return if use_block_argument_in_method_argument_of_operand?(block_argument, rhs)
rhs.source
elsif block_argument.source == block_body.first_argument.source elsif block_argument.source == block_body.first_argument.source
block_body.receiver.source lhs = block_body.receiver
return if use_block_argument_in_method_argument_of_operand?(block_argument, lhs)
lhs.source
end end
end end
def use_block_argument_in_method_argument_of_operand?(block_argument, operand)
return false unless operand.send_type?
arguments = operand.arguments
arguments.inject(arguments.map(&:source)) do |operand_sources, argument|
operand_sources + argument.each_descendant(:lvar).map(&:source)
end.any?(block_argument.source)
end
def offense_range(node) def offense_range(node)
node.send_node.loc.selector.join(node.source_range.end) node.send_node.loc.selector.join(node.source_range.end)
end end

View File

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