diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 7c68605f2a..afc8d1b72d 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -105,7 +105,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.4.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.49.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-capybara-2.17.1/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.16.0/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.17.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.19.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.19.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.7.0/lib") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml index ee6aaad3d8..6993c89521 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/default.yml @@ -226,6 +226,7 @@ Performance/RedundantEqualityComparisonBlock: Reference: 'https://github.com/rails/rails/pull/41363' Enabled: pending Safe: false + AllowRegexpMatch: true VersionAdded: '1.10' Performance/RedundantMatch: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/obsoletion.yml similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/config/obsoletion.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/config/obsoletion.yml diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop-performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop-performance.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop-performance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop-performance.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/regexp_metacharacter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/regexp_metacharacter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/mixin/sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/sort_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/mixin/sort_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/mixin/sort_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/ancestors_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/ancestors_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/ancestors_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/ancestors_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/bind_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/bind_call.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/bind_call.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/bind_call.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/block_given_with_explicit_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/block_given_with_explicit_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/block_given_with_explicit_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/block_given_with_explicit_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/caller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/caller.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/caller.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/caller.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/case_when_splat.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/case_when_splat.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb index 08ee889a8e..0fc30bd660 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/case_when_splat.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/case_when_splat.rb @@ -99,7 +99,7 @@ module RuboCop def inline_fix_branch(corrector, when_node) conditions = when_node.conditions - range = range_between(conditions[0].loc.expression.begin_pos, conditions[-1].loc.expression.end_pos) + range = range_between(conditions[0].source_range.begin_pos, conditions[-1].source_range.end_pos) corrector.replace(range, replacement(conditions)) end @@ -110,7 +110,7 @@ module RuboCop return if when_branches.one? corrector.remove(when_branch_range(when_node)) - corrector.insert_after(when_branches.last.source_range, reordering_correction(when_node)) + corrector.insert_after(when_branches.last, reordering_correction(when_node)) end def reordering_correction(when_node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/casecmp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/casecmp.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/casecmp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/casecmp.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/chain_array_allocation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/chain_array_allocation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/chain_array_allocation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/chain_array_allocation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/collection_literal_in_loop.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/collection_literal_in_loop.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/compare_with_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/compare_with_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/compare_with_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/compare_with_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/concurrent_monotonic_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/concurrent_monotonic_time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/concurrent_monotonic_time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/concurrent_monotonic_time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/constant_regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/constant_regexp.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/constant_regexp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/constant_regexp.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/count.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/count.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb index 97b7debaea..ff80f8abb3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/count.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/count.rb @@ -110,7 +110,7 @@ module RuboCop def negate_block_pass_reject(corrector, node) corrector.replace( - node.receiver.loc.expression.with(begin_pos: node.receiver.loc.begin.begin_pos), + node.receiver.source_range.with(begin_pos: node.receiver.loc.begin.begin_pos), negate_block_pass_as_inline_block(node.receiver) ) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/delete_prefix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_prefix.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/delete_prefix.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_prefix.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/delete_suffix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_suffix.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/delete_suffix.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/delete_suffix.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/detect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/detect.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb index 8367c4db79..2ef70a5526 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/detect.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/detect.rb @@ -8,12 +8,9 @@ module RuboCop # `detect` instead. # # @safety - # This cop is unsafe because is assumes the class implements the - # `Enumerable` interface, but can't reliably detect this. This creates - # known compatibility issues with `Hash`, `ActiveRecord` and other - # frameworks. `Hash` and `ActiveRecord` do not implement a `detect` - # method and `find` has its own meaning. Correcting `Hash` and - # `ActiveRecord` methods with this cop should be considered unsafe. + # This cop is unsafe because it assumes that the receiver is an + # `Array` or equivalent, but can't reliably detect it. For example, + # if the receiver is a `Hash`, it may report a false positive. # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/double_start_end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/double_start_end_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb index df1dea94f6..8ec3e10cc6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/double_start_end_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/double_start_end_with.rb @@ -58,8 +58,8 @@ module RuboCop private def autocorrect(corrector, first_call_args, second_call_args, combined_args) - first_argument = first_call_args.first.loc.expression - last_argument = second_call_args.last.loc.expression + first_argument = first_call_args.first.source_range + last_argument = second_call_args.last.source_range range = first_argument.join(last_argument) corrector.replace(range, combined_args) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/end_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb index 2430f84931..f7022300ad 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/end_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/end_with.rb @@ -69,7 +69,7 @@ module RuboCop new_source = "#{receiver.source}.end_with?(#{to_string_literal(regex_str)})" - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end end alias on_match_with_lvasgn on_send diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/fixed_size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/fixed_size.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/fixed_size.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/fixed_size.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/flat_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/flat_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb index 29cd0fe62e..529bf13870 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/flat_map.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/flat_map.rb @@ -28,7 +28,7 @@ module RuboCop def_node_matcher :flat_map_candidate?, <<~PATTERN (send { - (block $(send _ ${:collect :map}) ...) + $(block (send _ ${:collect :map}) ...) $(send _ ${:collect :map} (block_pass _)) } ${:flatten :flatten!} @@ -60,7 +60,8 @@ module RuboCop end def register_offense(node, map_node, first_method, flatten, message) - range = range_between(map_node.loc.selector.begin_pos, node.loc.expression.end_pos) + map_send_node = map_node.block_type? ? map_node.send_node : map_node + range = range_between(map_send_node.loc.selector.begin_pos, node.source_range.end_pos) message = format(message, method: first_method, flatten: flatten) add_offense(range, message: message) do |corrector| @@ -74,10 +75,11 @@ module RuboCop return unless flatten_level - range = range_between(node.loc.dot.begin_pos, node.source_range.end_pos) + map_send_node = map_node.block_type? ? map_node.send_node : map_node + range = range_between(map_node.source_range.end_pos, node.source_range.end_pos) corrector.remove(range) - corrector.replace(map_node.loc.selector, 'flat_map') + corrector.replace(map_send_node.loc.selector, 'flat_map') end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/inefficient_hash_search.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/inefficient_hash_search.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb index 3af118e250..16a10d235c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/inefficient_hash_search.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/inefficient_hash_search.rb @@ -57,7 +57,7 @@ module RuboCop # Replace `keys.include?` or `values.include?` with the appropriate # `key?`/`value?` method. corrector.replace( - node.loc.expression, + node, "#{autocorrect_hash_expression(node)}.#{autocorrect_method(node)}(#{autocorrect_argument(node)})" ) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/io_readlines.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/io_readlines.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb index 354bc7eca6..adc26bf6e8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/io_readlines.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/io_readlines.rb @@ -95,7 +95,7 @@ module RuboCop begin_pos = readlines_call.loc.selector.begin_pos end_pos = if enumerable_call.method?(:each) - enumerable_call.loc.expression.end_pos + enumerable_call.source_range.end_pos else enumerable_call.loc.dot.begin_pos end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/map_compact.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/map_compact.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/map_compact.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/map_compact.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/method_object_as_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/method_object_as_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/method_object_as_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/method_object_as_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/open_struct.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/open_struct.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/open_struct.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/open_struct.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/range_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/range_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/range_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/range_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_block_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_block_call.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb index d3b6a3d992..01bae4e163 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_block_call.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_block_call.rb @@ -75,7 +75,7 @@ module RuboCop new_source << CLOSE_PAREN if parentheses?(node) && !args.empty? - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end def calls_to_report(argname, body) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb similarity index 75% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb index 39903b3176..2600f5c969 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb @@ -10,6 +10,16 @@ module RuboCop # behavior is appropriately overridden in subclass. For example, # `Range#===` returns `true` when argument is within the range. # + # This cop has `AllowRegexpMatch` option and it is true by default because + # `regexp.match?('string')` often used in block changes to the opposite result: + # + # [source,ruby] + # ---- + # [/pattern/].all? { |regexp| regexp.match?('pattern') } # => true + # [/pattern/].all? { |regexp| regexp =~ 'pattern' } # => true + # [/pattern/].all?('pattern') # => false + # ---- + # # @safety # This cop is unsafe because `===` and `==` do not always behave the same. # @@ -22,6 +32,19 @@ module RuboCop # # # good # items.all?(pattern) + # items.all?(Klass) + # + # @example AllowRegexpMatch: true (default) + # + # # good + # items.all? { |item| item =~ pattern } + # items.all? { |item| item.match?(pattern) } + # + # @example AllowRegexpMatch: false + # + # # bad + # items.all? { |item| item =~ pattern } + # items.all? { |item| item.match?(pattern) } # class RedundantEqualityComparisonBlock < Base extend AutoCorrector @@ -33,6 +56,7 @@ module RuboCop TARGET_METHODS = %i[all? any? one? none?].freeze COMPARISON_METHODS = %i[== === is_a? kind_of?].freeze + REGEXP_METHODS = %i[=~ match?].freeze IS_A_METHODS = %i[is_a? kind_of?].freeze def on_block(node) @@ -60,7 +84,11 @@ module RuboCop end def use_equality_comparison_block?(block_body) - block_body.send_type? && COMPARISON_METHODS.include?(block_body.method_name) + return false unless block_body.send_type? + + method_name = block_body.method_name + + COMPARISON_METHODS.include?(method_name) || (!allow_regexp_match? && REGEXP_METHODS.include?(method_name)) end def same_block_argument_and_is_a_argument?(block_body, block_argument) @@ -99,6 +127,10 @@ module RuboCop def offense_range(node) node.send_node.loc.selector.join(node.source_range.end) end + + def allow_regexp_match? + cop_config.fetch('AllowRegexpMatch', true) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_match.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb index 23539c529b..ef7a1a8eef 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_match.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_match.rb @@ -49,7 +49,7 @@ module RuboCop def autocorrect(corrector, node) new_source = "#{node.receiver.source} =~ #{node.first_argument.source}" - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end def autocorrectable?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb index 9493dce535..80fd392108 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_merge.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_merge.rb @@ -112,11 +112,11 @@ module RuboCop new_source.gsub!(/\n/, padding) end - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end def correct_single_element(corrector, node, new_source) - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end def to_assignments(receiver, pairs) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_sort_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_sort_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_sort_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_string_chars.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_string_chars.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb index f6617068ba..4fd4b0422a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/redundant_string_chars.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/redundant_string_chars.rb @@ -69,11 +69,11 @@ module RuboCop private def offense_range(receiver, node) - range_between(receiver.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(receiver.loc.selector.begin_pos, node.source_range.end_pos) end def correction_range(receiver, node) - range_between(receiver.loc.dot.begin_pos, node.loc.expression.end_pos) + range_between(receiver.loc.dot.begin_pos, node.source_range.end_pos) end def build_message(method, args) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/regexp_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/regexp_match.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb index 43ba6e74fe..0fbd6fc627 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/regexp_match.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/regexp_match.rb @@ -185,9 +185,9 @@ module RuboCop def range_to_search_for_last_matches(match_node, body, scope_root) expression = if modifier_form?(match_node) - match_node.parent.if_branch.loc.expression + match_node.parent.if_branch.source_range else - match_node.loc.expression + match_node.source_range end match_node_pos = expression.begin_pos @@ -199,15 +199,15 @@ module RuboCop def next_match_pos(body, match_node_pos, scope_root) node = search_match_nodes(body).find do |match| begin_pos = if modifier_form?(match) - match.parent.if_branch.loc.expression.begin_pos + match.parent.if_branch.source_range.begin_pos else - match.loc.expression.begin_pos + match.source_range.begin_pos end begin_pos > match_node_pos && scope_root(match) == scope_root end - node ? node.loc.expression.begin_pos : Float::INFINITY + node ? node.source_range.begin_pos : Float::INFINITY end def modifier_form?(match_node) @@ -216,7 +216,7 @@ module RuboCop def find_last_match(body, range, scope_root) last_matches(body).find do |ref| - ref_pos = ref.loc.expression.begin_pos + ref_pos = ref.source_range.begin_pos range.cover?(ref_pos) && scope_root(ref) == scope_root end end @@ -248,8 +248,8 @@ module RuboCop replace_with_match_predicate_method(corrector, recv, arg, op_range) - corrector.insert_after(arg.loc.expression, ')') unless op_range.source.end_with?('(') - corrector.insert_before(recv.loc.expression, '!') if oper == :!~ + corrector.insert_after(arg, ')') unless op_range.source.end_with?('(') + corrector.insert_before(recv, '!') if oper == :!~ end def replace_with_match_predicate_method(corrector, recv, arg, op_range) @@ -264,14 +264,14 @@ module RuboCop end def swap_receiver_and_arg(corrector, recv, arg) - corrector.replace(recv.loc.expression, arg.source) - corrector.replace(arg.loc.expression, recv.source) + corrector.replace(recv, arg.source) + corrector.replace(arg, recv.source) end def correction_range(recv, arg) buffer = processed_source.buffer - op_begin_pos = recv.loc.expression.end_pos - op_end_pos = arg.loc.expression.begin_pos + op_begin_pos = recv.source_range.end_pos + op_end_pos = arg.source_range.begin_pos Parser::Source::Range.new(buffer, op_begin_pos, op_end_pos) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_each.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_each.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_first.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_first.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb index dde61bd38a..3775fad764 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/reverse_first.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/reverse_first.rb @@ -43,7 +43,7 @@ module RuboCop private def correction_range(receiver, node) - range_between(receiver.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(receiver.loc.selector.begin_pos, node.source_range.end_pos) end def build_message(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/select_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/select_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb index ee13f68ad3..a0676e9d09 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/select_map.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/select_map.rb @@ -52,7 +52,7 @@ module RuboCop end def offense_range(node, map_method) - range_between(node.loc.selector.begin_pos, map_method.loc.expression.end_pos) + range_between(node.loc.selector.begin_pos, map_method.source_range.end_pos) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/size.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/size.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/size.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sort_reverse.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sort_reverse.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sort_reverse.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sort_reverse.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/squeeze.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/squeeze.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb index 7691b170f8..13040ad721 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/squeeze.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/squeeze.rb @@ -48,7 +48,7 @@ module RuboCop string_literal = to_string_literal(replace_str) new_code = "#{receiver.source}.#{good_method}(#{string_literal})" - corrector.replace(node.source_range, new_code) + corrector.replace(node, new_code) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/start_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/start_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb index c1d2853d86..ebb2a31d61 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/start_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/start_with.rb @@ -69,7 +69,7 @@ module RuboCop new_source = "#{receiver.source}.start_with?(#{to_string_literal(regex_str)})" - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end end alias on_match_with_lvasgn on_send diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_identifier_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_identifier_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb index 00a0bacd9e..3d3abb9640 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_identifier_argument.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_identifier_argument.rb @@ -27,28 +27,33 @@ module RuboCop MSG = 'Use `%s` instead of `%s`.' + COMMAND_METHODS = %i[ + alias_method attr_accessor attr_reader attr_writer autoload autoload? private private_constant + protected public public_constant module_function + ].freeze + # NOTE: `attr` method is not included in this list as it can cause false positives in Nokogiri API. # And `attr` may not be used because `Style/Attr` registers an offense. # https://github.com/rubocop/rubocop-performance/issues/278 - RESTRICT_ON_SEND = %i[ - alias_method attr_accessor attr_reader attr_writer autoload autoload? + RESTRICT_ON_SEND = (%i[ class_variable_defined? const_defined? const_get const_set const_source_location define_method instance_method method_defined? private_class_method? private_method_defined? protected_method_defined? public_class_method public_instance_method public_method_defined? remove_class_variable remove_method undef_method class_variable_get class_variable_set - deprecate_constant module_function private private_constant protected public public_constant - remove_const ruby2_keywords - define_singleton_method instance_variable_defined? instance_variable_get instance_variable_set - method public_method public_send remove_instance_variable respond_to? send singleton_method - __send__ - ].freeze + deprecate_constant remove_const ruby2_keywords define_singleton_method instance_variable_defined? + instance_variable_get instance_variable_set method public_method public_send remove_instance_variable + respond_to? send singleton_method __send__ + ] + COMMAND_METHODS).freeze def on_send(node) + return if COMMAND_METHODS.include?(node.method_name) && node.receiver return unless (first_argument = node.first_argument) return unless first_argument.str_type? - return if first_argument.value.include?(' ') || first_argument.value.include?('::') - replacement = first_argument.value.to_sym.inspect + first_argument_value = first_argument.value + return if first_argument_value.include?(' ') || first_argument_value.include?('::') + + replacement = first_argument_value.to_sym.inspect message = format(MSG, symbol_arg: replacement, string_arg: first_argument.source) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb index c605a3b39d..b3502c1bdc 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_include.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_include.rb @@ -43,7 +43,7 @@ module RuboCop new_source = "#{'!' if negation}#{receiver.source}.include?(#{to_string_literal(regex_str)})" - corrector.replace(node.source_range, new_source) + corrector.replace(node, new_source) end end alias on_match_with_lvasgn on_send diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_replacement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_replacement.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb index e4cd35d0c6..80c06ddb62 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/string_replacement.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/string_replacement.rb @@ -70,7 +70,7 @@ module RuboCop replacement_method = replacement_method(node, first_source, second_source) corrector.replace(node.loc.selector, replacement_method) - corrector.replace(first_param.source_range, to_string_literal(first_source)) unless first_param.str_type? + corrector.replace(first_param, to_string_literal(first_source)) unless first_param.str_type? remove_second_param(corrector, node, first_param) if second_source.empty? && first_source.length == 1 end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sum.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sum.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb index f81e00b7c4..a9cc9ab17e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/sum.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/sum.rb @@ -183,7 +183,7 @@ module RuboCop end def sum_method_range(node) - range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + range_between(node.loc.selector.begin_pos, node.source_range.end_pos) end def sum_map_range(map, sum) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/times_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/times_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb index 18584e2c52..58e76cbe62 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/times_map.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/times_map.rb @@ -52,7 +52,7 @@ module RuboCop add_offense(node, message: message(map_or_collect, count)) do |corrector| replacement = "Array.new(#{count.source}#{map_or_collect.arguments.map { |arg| ", #{arg.source}" }.join})" - corrector.replace(map_or_collect.loc.expression, replacement) + corrector.replace(map_or_collect, replacement) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/unfreeze_string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/unfreeze_string.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/unfreeze_string.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/unfreeze_string.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/uri_default_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/uri_default_parser.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb index 636c9b055a..4ce34da0b2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance/uri_default_parser.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance/uri_default_parser.rb @@ -30,7 +30,7 @@ module RuboCop message = format(MSG, double_colon: double_colon) add_offense(node, message: message) do |corrector| - corrector.replace(node.loc.expression, "#{double_colon}URI::DEFAULT_PARSER") + corrector.replace(node, "#{double_colon}URI::DEFAULT_PARSER") end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance_cops.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/cop/performance_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/cop/performance_cops.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb index 0de76a386c..f854256ef6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.16.0/lib/rubocop/performance/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.17.1/lib/rubocop/performance/version.rb @@ -4,7 +4,7 @@ module RuboCop module Performance # This module holds the RuboCop Performance version information. module Version - STRING = '1.16.0' + STRING = '1.17.1' def self.document_version STRING.match('\d+\.\d+').to_s