Skip to content

Commit

Permalink
Merge pull request #11879 from Homebrew/dependabot/bundler/Library/Ho…
Browse files Browse the repository at this point in the history
…mebrew/rubocop-performance-1.11.5

build(deps): bump rubocop-performance from 1.11.4 to 1.11.5 in /Library/Homebrew
  • Loading branch information
nandahkrishna committed Aug 18, 2021
2 parents 7011e0f + 9757b7b commit 8d2811e
Show file tree
Hide file tree
Showing 59 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.10.0)
parser (>= 3.0.1.1)
rubocop-performance (1.11.4)
rubocop-performance (1.11.5)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.11.3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ class RuboCop::Cop::Performance::RedundantEqualityComparisonBlock < ::RuboCop::C
def offense_range(node); end
def one_block_argument?(block_arguments); 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
end

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/vendor/bundle/bundler/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
$:.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.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-rspec-2.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def remove_compact_method(corrector, compact_node)
chained_method = compact_node.parent
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)
compact_method_range = range_by_whole_lines(compact_method_range, include_final_newline: true)
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,27 @@ def same_block_argument_and_is_a_argument?(block_body, block_argument)

def new_argument(block_argument, block_body)
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
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

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)
node.send_node.loc.selector.join(node.source_range.end)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module RuboCop
module Performance
# This module holds the RuboCop Performance version information.
module Version
STRING = '1.11.4'
STRING = '1.11.5'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down

0 comments on commit 8d2811e

Please sign in to comment.