From 1ab5344aadc10566940b86036fc9073e7abe3ee8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Dec 2021 18:02:54 +0000 Subject: [PATCH 1/4] build(deps): bump rubocop-performance in /Library/Homebrew Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.12.0 to 1.13.0. - [Release notes](https://github.com/rubocop/rubocop-performance/releases) - [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.12.0...v1.13.0) --- updated-dependencies: - dependency-name: rubocop-performance dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Library/Homebrew/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index ed8e4d450a..38ff497be1 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -135,7 +135,7 @@ GEM unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.15.1) parser (>= 3.0.1.1) - rubocop-performance (1.12.0) + rubocop-performance (1.13.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) rubocop-rails (2.13.0) From c0cd8d9301f75971dce5934a11618390cab1138c Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 28 Dec 2021 18:05:32 +0000 Subject: [PATCH 2/4] brew vendor-gems: commit updates. --- .../Homebrew/vendor/bundle/bundler/setup.rb | 2 +- .../big_decimal_with_numeric_argument.rb | 46 ------------- .../config/default.yml | 21 ++++-- .../config/obsoletion.yml | 0 .../lib/rubocop-performance.rb | 0 .../rubocop/cop/mixin/regexp_metacharacter.rb | 0 .../lib/rubocop/cop/mixin/sort_block.rb | 0 .../cop/performance/ancestors_include.rb | 0 .../array_semi_infinite_range_slice.rb | 0 .../big_decimal_with_numeric_argument.rb | 57 ++++++++++++++++ .../lib/rubocop/cop/performance/bind_call.rb | 0 .../block_given_with_explicit_block.rb | 0 .../lib/rubocop/cop/performance/caller.rb | 0 .../cop/performance/case_when_splat.rb | 0 .../lib/rubocop/cop/performance/casecmp.rb | 0 .../cop/performance/chain_array_allocation.rb | 0 .../performance/collection_literal_in_loop.rb | 0 .../cop/performance/compare_with_block.rb | 0 .../performance/concurrent_monotonic_time.rb | 0 .../cop/performance/constant_regexp.rb | 0 .../lib/rubocop/cop/performance/count.rb | 0 .../rubocop/cop/performance/delete_prefix.rb | 0 .../rubocop/cop/performance/delete_suffix.rb | 0 .../lib/rubocop/cop/performance/detect.rb | 4 -- .../cop/performance/double_start_end_with.rb | 21 ++++++ .../lib/rubocop/cop/performance/end_with.rb | 0 .../lib/rubocop/cop/performance/fixed_size.rb | 0 .../lib/rubocop/cop/performance/flat_map.rb | 0 .../performance/inefficient_hash_search.rb | 0 .../rubocop/cop/performance/io_readlines.rb | 0 .../rubocop/cop/performance/map_compact.rb | 20 ++++-- .../cop/performance/method_object_as_block.rb | 0 .../rubocop/cop/performance/open_struct.rb | 0 .../rubocop/cop/performance/range_include.rb | 0 .../cop/performance/redundant_block_call.rb | 0 .../redundant_equality_comparison_block.rb | 0 .../cop/performance/redundant_match.rb | 0 .../cop/performance/redundant_merge.rb | 0 .../cop/performance/redundant_sort_block.rb | 0 .../redundant_split_regexp_argument.rb | 0 .../cop/performance/redundant_string_chars.rb | 22 ++++-- .../rubocop/cop/performance/regexp_match.rb | 0 .../rubocop/cop/performance/reverse_each.rb | 0 .../rubocop/cop/performance/reverse_first.rb | 0 .../lib/rubocop/cop/performance/select_map.rb | 0 .../lib/rubocop/cop/performance/size.rb | 0 .../rubocop/cop/performance/sort_reverse.rb | 0 .../lib/rubocop/cop/performance/squeeze.rb | 0 .../lib/rubocop/cop/performance/start_with.rb | 0 .../performance/string_identifier_argument.rb | 59 ++++++++++++++++ .../rubocop/cop/performance/string_include.rb | 0 .../cop/performance/string_replacement.rb | 0 .../lib/rubocop/cop/performance/sum.rb | 68 +++++++++++++------ .../lib/rubocop/cop/performance/times_map.rb | 0 .../cop/performance/unfreeze_string.rb | 0 .../cop/performance/uri_default_parser.rb | 0 .../lib/rubocop/cop/performance_cops.rb | 1 + .../lib/rubocop/performance.rb | 0 .../lib/rubocop/performance/inject.rb | 0 .../lib/rubocop/performance/version.rb | 2 +- 60 files changed, 231 insertions(+), 92 deletions(-) delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/config/default.yml (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/config/obsoletion.yml (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop-performance.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/mixin/regexp_metacharacter.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/mixin/sort_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/ancestors_include.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/bind_call.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/block_given_with_explicit_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/caller.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/case_when_splat.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/casecmp.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/chain_array_allocation.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/collection_literal_in_loop.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/compare_with_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/concurrent_monotonic_time.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/constant_regexp.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/count.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/delete_prefix.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/delete_suffix.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/detect.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/double_start_end_with.rb (78%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/end_with.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/fixed_size.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/flat_map.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/inefficient_hash_search.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/io_readlines.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/map_compact.rb (75%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/method_object_as_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/open_struct.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/range_include.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/redundant_block_call.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/redundant_match.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/redundant_merge.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/redundant_sort_block.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/redundant_string_chars.rb (86%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/regexp_match.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/reverse_each.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/reverse_first.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/select_map.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/size.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/sort_reverse.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/squeeze.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/start_with.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/string_identifier_argument.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/string_include.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/string_replacement.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/sum.rb (77%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/times_map.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/unfreeze_string.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance/uri_default_parser.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/cop/performance_cops.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/performance.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/performance/inject.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{rubocop-performance-1.12.0 => rubocop-performance-1.13.0}/lib/rubocop/performance/version.rb (91%) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index d46ffcde13..8cb674989f 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -87,7 +87,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-ast-1.15.1/li $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.24.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.12.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.13.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.13.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.7.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.5/lib" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb deleted file mode 100644 index 1248544cf2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -module RuboCop - module Cop - module Performance - # This cop identifies places where numeric argument to BigDecimal should be - # converted to string. Initializing from String is faster - # than from Numeric for BigDecimal. - # - # @example - # # bad - # BigDecimal(1, 2) - # BigDecimal(1.2, 3, exception: true) - # - # # good - # BigDecimal('1', 2) - # BigDecimal('1.2', 3, exception: true) - # - class BigDecimalWithNumericArgument < Base - extend AutoCorrector - - MSG = 'Convert numeric argument to string before passing to `BigDecimal`.' - RESTRICT_ON_SEND = %i[BigDecimal].freeze - - def_node_matcher :big_decimal_with_numeric_argument?, <<~PATTERN - (send nil? :BigDecimal $numeric_type? ...) - PATTERN - - def on_send(node) - return unless (numeric = big_decimal_with_numeric_argument?(node)) - return if numeric.float_type? && specifies_precision?(node) - - add_offense(numeric.source_range) do |corrector| - corrector.wrap(numeric, "'", "'") - end - end - - private - - def specifies_precision?(node) - node.arguments.size > 1 && !node.arguments[1].hash_type? - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/config/default.yml similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/config/default.yml index 446b24a760..b0fe7a584b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/config/default.yml @@ -17,7 +17,7 @@ Performance/ArraySemiInfiniteRangeSlice: VersionAdded: '1.9' Performance/BigDecimalWithNumericArgument: - Description: 'Convert numeric argument to string before passing to BigDecimal.' + Description: 'Convert numeric literal to string and pass it to `BigDecimal`.' Enabled: 'pending' VersionAdded: '1.7' @@ -43,10 +43,9 @@ Performance/CaseWhenSplat: Reordering `when` conditions with a splat to the end of the `when` branches can improve performance. Enabled: false - AutoCorrect: false SafeAutoCorrect: false VersionAdded: '0.34' - VersionChanged: '0.59' + VersionChanged: '1.13' Performance/Casecmp: Description: >- @@ -137,7 +136,7 @@ Performance/DoubleStartEndWith: VersionAdded: '0.36' VersionChanged: '0.48' # Used to check for `starts_with?` and `ends_with?`. - # These methods are defined by `ActiveSupport`. + # These methods are defined by Active Support. IncludeActiveSupportAliases: false Performance/EndWith: @@ -312,6 +311,11 @@ Performance/StartWith: VersionAdded: '0.36' VersionChanged: '1.10' +Performance/StringIdentifierArgument: + Description: 'Use symbol identifier argument instead of string identifier argument.' + Enabled: pending + VersionAdded: '1.13' + Performance/StringInclude: Description: 'Use `String#include?` instead of a regex match with literal-only pattern.' Enabled: 'pending' @@ -330,17 +334,20 @@ Performance/StringReplacement: Performance/Sum: Description: 'Use `sum` instead of a custom array summation.' + SafeAutoCorrect: false Reference: 'https://blog.bigbinary.com/2016/11/02/ruby-2-4-introduces-enumerable-sum.html' Enabled: 'pending' VersionAdded: '1.8' + VersionChanged: '1.13' + OnlySumOrWithInitialValue: false Performance/TimesMap: Description: 'Checks for .times.map calls.' - AutoCorrect: false Enabled: true + # See https://github.com/rubocop/rubocop/issues/4658 + SafeAutoCorrect: false VersionAdded: '0.36' - VersionChanged: '0.50' - SafeAutoCorrect: false # see https://github.com/rubocop/rubocop/issues/4658 + VersionChanged: '1.13' Performance/UnfreezeString: Description: 'Use unary plus to get an unfrozen string literal.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/config/obsoletion.yml similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/config/obsoletion.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/config/obsoletion.yml diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop-performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop-performance.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop-performance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop-performance.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/mixin/regexp_metacharacter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/mixin/sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/mixin/sort_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/mixin/sort_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/mixin/sort_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/ancestors_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/ancestors_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/ancestors_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/ancestors_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.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.13.0/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.13.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb new file mode 100644 index 0000000000..dfddc2e59f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Performance + # This cop identifies places where numeric argument to BigDecimal should be + # converted to string. Initializing from String is faster + # than from Numeric for BigDecimal. + # + # @example + # # bad + # BigDecimal(1, 2) + # 4.to_d(6) + # BigDecimal(1.2, 3, exception: true) + # 4.5.to_d(6, exception: true) + # + # # good + # BigDecimal('1', 2) + # BigDecimal('4', 6) + # BigDecimal('1.2', 3, exception: true) + # BigDecimal('4.5', 6, exception: true) + # + class BigDecimalWithNumericArgument < Base + extend AutoCorrector + + MSG = 'Convert numeric literal to string and pass it to `BigDecimal`.' + RESTRICT_ON_SEND = %i[BigDecimal to_d].freeze + + def_node_matcher :big_decimal_with_numeric_argument?, <<~PATTERN + (send nil? :BigDecimal $numeric_type? ...) + PATTERN + + def_node_matcher :to_d?, <<~PATTERN + (send [!nil? $numeric_type?] :to_d ...) + PATTERN + + def on_send(node) + if (numeric = big_decimal_with_numeric_argument?(node)) + add_offense(numeric.source_range) do |corrector| + corrector.wrap(numeric, "'", "'") + end + elsif (numeric_to_d = to_d?(node)) + add_offense(numeric_to_d.source_range) do |corrector| + big_decimal_args = node + .arguments + .map(&:source) + .unshift("'#{numeric_to_d.source}'") + .join(', ') + + corrector.replace(node, "BigDecimal(#{big_decimal_args})") + end + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/bind_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/bind_call.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/bind_call.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/bind_call.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/block_given_with_explicit_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.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.13.0/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.12.0/lib/rubocop/cop/performance/caller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/caller.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/caller.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/caller.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/case_when_splat.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/case_when_splat.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/case_when_splat.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/case_when_splat.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/casecmp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/casecmp.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/casecmp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/casecmp.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/chain_array_allocation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.0/lib/rubocop/cop/performance/chain_array_allocation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/chain_array_allocation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/collection_literal_in_loop.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/compare_with_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.0/lib/rubocop/cop/performance/compare_with_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/compare_with_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/concurrent_monotonic_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.0/lib/rubocop/cop/performance/concurrent_monotonic_time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/concurrent_monotonic_time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/constant_regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/constant_regexp.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/constant_regexp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/constant_regexp.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/count.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/count.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/count.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/count.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/delete_prefix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/delete_prefix.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/delete_prefix.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/delete_prefix.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/delete_suffix.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/delete_suffix.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/delete_suffix.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/delete_suffix.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/detect.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/detect.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/detect.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/detect.rb index ac413e7cc9..7ad329cddd 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/detect.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/detect.rb @@ -27,10 +27,6 @@ module RuboCop # [].detect { |item| true } # [].reverse.detect { |item| true } # - # `ActiveRecord` compatibility: - # `ActiveRecord` does not implement a `detect` method and `find` has its - # own meaning. Correcting ActiveRecord methods with this cop should be - # considered unsafe. class Detect < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/double_start_end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/double_start_end_with.rb similarity index 78% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/double_start_end_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/double_start_end_with.rb index bc40a22de3..d9af50cfd4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/double_start_end_with.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/double_start_end_with.rb @@ -7,6 +7,9 @@ module RuboCop # separated by `||`. In some cases such calls can be replaced # with an single `#start_with?`/`#end_with?` call. # + # `IncludeActiveSupportAliases` configuration option is used to check for + # `starts_with?` and `ends_with?`. These methods are defined by Active Support. + # # @example # # bad # str.start_with?("a") || str.start_with?(Some::CONST) @@ -17,6 +20,24 @@ module RuboCop # str.start_with?("a", Some::CONST) # str.start_with?("a", "b", "c") # str.end_with?(var1, var2) + # + # @example IncludeActiveSupportAliases: false (default) + # # good + # str.starts_with?("a", "b") || str.starts_with?("c") + # str.ends_with?(var1) || str.ends_with?(var2) + # + # str.starts_with?("a", "b", "c") + # str.ends_with?(var1, var2) + # + # @example IncludeActiveSupportAliases: true + # # bad + # str.starts_with?("a", "b") || str.starts_with?("c") + # str.ends_with?(var1) || str.ends_with?(var2) + # + # # good + # str.starts_with?("a", "b", "c") + # str.ends_with?(var1, var2) + # class DoubleStartEndWith < Base extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/end_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/end_with.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/end_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/end_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/fixed_size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/fixed_size.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/fixed_size.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/fixed_size.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/flat_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/flat_map.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/flat_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/flat_map.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/inefficient_hash_search.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/inefficient_hash_search.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/inefficient_hash_search.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/inefficient_hash_search.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/io_readlines.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/io_readlines.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/io_readlines.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/io_readlines.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/map_compact.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/map_compact.rb similarity index 75% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/map_compact.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/map_compact.rb index 6cba8a07e1..f1be87b2bb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/map_compact.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/map_compact.rb @@ -58,19 +58,19 @@ module RuboCop add_offense(range) do |corrector| corrector.replace(map_node.loc.selector, 'filter_map') - remove_compact_method(corrector, node) + remove_compact_method(corrector, node, node.parent) end end private - def remove_compact_method(corrector, compact_node) - chained_method = compact_node.parent + def remove_compact_method(corrector, compact_node, chained_method) compact_method_range = compact_node.loc.selector if compact_node.multiline? && chained_method&.loc.respond_to?(:selector) && chained_method.dot? && + !map_method_and_compact_method_on_same_line?(compact_node) && !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 = compact_method_with_final_newline_range(compact_method_range) else corrector.remove(compact_node.loc.dot) end @@ -78,9 +78,21 @@ module RuboCop corrector.remove(compact_method_range) end + def map_method_and_compact_method_on_same_line?(compact_node) + return false unless compact_node.children.first.respond_to?(:send_node) + + map_node = compact_node.children.first.send_node + + compact_node.loc.selector.line == map_node.loc.selector.line + end + def invoke_method_after_map_compact_on_same_line?(compact_node, chained_method) compact_node.loc.selector.line == chained_method.loc.selector.line end + + def compact_method_with_final_newline_range(compact_method_range) + range_by_whole_lines(compact_method_range, include_final_newline: true) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/method_object_as_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.0/lib/rubocop/cop/performance/method_object_as_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/method_object_as_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/open_struct.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/open_struct.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/open_struct.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/open_struct.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/range_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/range_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/range_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/range_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_block_call.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_block_call.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_block_call.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_block_call.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_match.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_match.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_match.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_merge.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_merge.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_sort_block.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.0/lib/rubocop/cop/performance/redundant_sort_block.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_sort_block.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.0/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_string_chars.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_string_chars.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_string_chars.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_string_chars.rb index 20d9bc0c0c..d0d4972881 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/redundant_string_chars.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/redundant_string_chars.rb @@ -82,14 +82,10 @@ module RuboCop def build_good_method(method, args) case method - when :[], :slice + when :slice "[#{build_call_args(args)}].chars" - when :first - if args.any? - "[0...#{args.first.source}].chars" - else - '[0]' - end + when :[], :first + build_good_method_for_brackets_or_first_method(method, args) when :take "[0...#{args.first.source}].chars" else @@ -97,6 +93,18 @@ module RuboCop end end + def build_good_method_for_brackets_or_first_method(method, args) + first_arg = args.first + + if first_arg&.range_type? + "[#{build_call_args(args)}].chars" + elsif method == :first && args.any? + "[0...#{args.first.source}].chars" + else + first_arg ? "[#{first_arg.source}]" : '[0]' + end + end + def build_bad_method(method, args) case method when :[] diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/regexp_match.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/regexp_match.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/regexp_match.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/regexp_match.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/reverse_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/reverse_each.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/reverse_each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/reverse_each.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/reverse_first.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/reverse_first.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/reverse_first.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/reverse_first.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/select_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/select_map.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/select_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/select_map.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/size.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/size.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/size.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/size.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/sort_reverse.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/sort_reverse.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/sort_reverse.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/sort_reverse.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/squeeze.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/squeeze.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/squeeze.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/squeeze.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/start_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/start_with.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/start_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/start_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/string_identifier_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/string_identifier_argument.rb new file mode 100644 index 0000000000..52b6606a6f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/string_identifier_argument.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Performance + # This cop identifies places where string identifier argument can be replaced + # by symbol identifier argument. + # It prevents the redundancy of the internal string-to-symbol conversion. + # + # This cop targets methods that take identifier (e.g. method name) argument + # and the following examples are parts of it. + # + # @example + # + # # bad + # send('do_something') + # attr_accessor 'do_something' + # instance_variable_get('@ivar') + # + # # good + # send(:do_something) + # attr_accessor :do_something + # instance_variable_get(:@ivar) + # + class StringIdentifierArgument < Base + extend AutoCorrector + + MSG = 'Use `%s` instead of `%s`.' + + RESTRICT_ON_SEND = %i[ + alias_method attr attr_accessor attr_reader attr_writer autoload autoload? + 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 + + def on_send(node) + return unless (first_argument = node.first_argument) + return unless first_argument.str_type? + return if first_argument.value.include?(' ') + + replacement = first_argument.value.to_sym.inspect + + message = format(MSG, symbol_arg: replacement, string_arg: first_argument.source) + + add_offense(first_argument, message: message) do |corrector| + corrector.replace(first_argument, replacement) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/string_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/string_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/string_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/string_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/string_replacement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/string_replacement.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/string_replacement.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/string_replacement.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/sum.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/sum.rb similarity index 77% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/sum.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/sum.rb index 30067a4c09..ebd9c08227 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/sum.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/sum.rb @@ -6,35 +6,46 @@ module RuboCop # This cop identifies places where custom code finding the sum of elements # in some Enumerable object can be replaced by `Enumerable#sum` method. # - # This cop can change auto-correction scope depending on the value of - # `SafeAutoCorrect`. - # Its auto-correction is marked as safe by default (`SafeAutoCorrect: true`) - # to prevent `TypeError` in auto-correced code when initial value is not - # specified as shown below: + # @safety + # Auto-corrections are unproblematic wherever an initial value is provided explicitly: # - # [source,ruby] - # ---- - # ['a', 'b'].sum # => (String can't be coerced into Integer) - # ---- + # [source,ruby] + # ---- + # [1, 2, 3].reduce(4, :+) # => 10 + # [1, 2, 3].sum(4) # => 10 # - # Therefore if initial value is not specified, unsafe auto-corrected will not occur. + # [].reduce(4, :+) # => 4 + # [].sum(4) # => 4 + # ---- # - # If you always want to enable auto-correction, you can set `SafeAutoCorrect: false`. + # This also holds true for non-numeric types which implement a `:+` method: # - # [source,yaml] - # ---- - # Performance/Sum: - # SafeAutoCorrect: false - # ---- + # [source,ruby] + # ---- + # ['l', 'o'].reduce('Hel', :+) # => "Hello" + # ['l', 'o'].sum('Hel') # => "Hello" + # ---- # - # Please note that the auto-correction command line option will be changed from - # `rubocop -a` to `rubocop -A`, which includes unsafe auto-correction. + # When no initial value is provided though, `Enumerable#reduce` will pick the first enumerated value + # as initial value and successively add all following values to it, whereas + # `Enumerable#sum` will set an initial value of `0` (`Integer`) which can lead to a `TypeError`: # - # @example + # [source,ruby] + # ---- + # [].reduce(:+) # => nil + # [1, 2, 3].reduce(:+) # => 6 + # ['H', 'e', 'l', 'l', 'o'].reduce(:+) # => "Hello" + # + # [].sum # => 0 + # [1, 2, 3].sum # => 6 + # ['H', 'e', 'l', 'l', 'o'].sum # => in `+': String can't be coerced into Integer (TypeError) + # ---- + # + # @example OnlySumOrWithInitialValue: false (default) # # bad - # [1, 2, 3].inject(:+) # These bad cases with no initial value are unsafe and - # [1, 2, 3].inject(&:+) # will not be auto-correced by default. If you want to - # [1, 2, 3].reduce { |acc, elem| acc + elem } # auto-corrected, you can set `SafeAutoCorrect: false`. + # [1, 2, 3].inject(:+) # Auto-corrections for cases without initial value are unsafe + # [1, 2, 3].inject(&:+) # and will only be performed when using the `-A` option. + # [1, 2, 3].reduce { |acc, elem| acc + elem } # They can be prohibited completely using `SafeAutoCorrect: true`. # [1, 2, 3].reduce(10, :+) # [1, 2, 3].map { |elem| elem ** 2 }.sum # [1, 2, 3].collect(&:count).sum(10) @@ -45,6 +56,17 @@ module RuboCop # [1, 2, 3].sum { |elem| elem ** 2 } # [1, 2, 3].sum(10, &:count) # + # @example OnlySumOrWithInitialValue: true + # # bad + # [1, 2, 3].reduce(10, :+) + # [1, 2, 3].map { |elem| elem ** 2 }.sum + # [1, 2, 3].collect(&:count).sum(10) + # + # # good + # [1, 2, 3].sum(10) + # [1, 2, 3].sum { |elem| elem ** 2 } + # [1, 2, 3].sum(10, &:count) + # class Sum < Base include RangeHelp extend AutoCorrector @@ -103,6 +125,8 @@ module RuboCop def handle_sum_candidate(node) sum_candidate?(node) do |method, init, operation| + next if cop_config['OnlySumOrWithInitialValue'] && init.empty? + range = sum_method_range(node) message = build_method_message(node, method, init, operation) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/times_map.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/times_map.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/times_map.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/times_map.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/unfreeze_string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/unfreeze_string.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/unfreeze_string.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/unfreeze_string.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/uri_default_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/uri_default_parser.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance/uri_default_parser.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance/uri_default_parser.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance_cops.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance_cops.rb index fc363b712d..02a64a6300 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/cop/performance_cops.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/cop/performance_cops.rb @@ -44,6 +44,7 @@ require_relative 'performance/size' require_relative 'performance/sort_reverse' require_relative 'performance/squeeze' require_relative 'performance/start_with' +require_relative 'performance/string_identifier_argument' require_relative 'performance/string_include' require_relative 'performance/string_replacement' require_relative 'performance/sum' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/performance.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/performance.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/performance.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/performance.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/performance/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/performance/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/performance/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/performance/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/performance/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/performance/version.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/performance/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/lib/rubocop/performance/version.rb index 805b4b613a..34d54f6a1c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.12.0/lib/rubocop/performance/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-performance-1.13.0/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.12.0' + STRING = '1.13.0' def self.document_version STRING.match('\d+\.\d+').to_s From 442af3772a0aa05801d9f380a3b8e27b3e427d2b Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Tue, 28 Dec 2021 18:11:17 +0000 Subject: [PATCH 3/4] Update RBI files for rubocop-performance. --- ...2.0.rbi => rubocop-performance@1.13.0.rbi} | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) rename Library/Homebrew/sorbet/rbi/gems/{rubocop-performance@1.12.0.rbi => rubocop-performance@1.13.0.rbi} (97%) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.12.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.13.0.rbi similarity index 97% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.12.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.13.0.rbi index 85e3be922b..e27ec8c5ea 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.12.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.13.0.rbi @@ -46,10 +46,7 @@ class RuboCop::Cop::Performance::BigDecimalWithNumericArgument < ::RuboCop::Cop: def big_decimal_with_numeric_argument?(param0 = T.unsafe(nil)); end def on_send(node); end - - private - - def specifies_precision?(node); end + def to_d?(param0 = T.unsafe(nil)); end end RuboCop::Cop::Performance::BigDecimalWithNumericArgument::MSG = T.let(T.unsafe(nil), String) @@ -406,8 +403,10 @@ class RuboCop::Cop::Performance::MapCompact < ::RuboCop::Cop::Base private + def compact_method_with_final_newline_range(compact_method_range); end def invoke_method_after_map_compact_on_same_line?(compact_node, chained_method); end - def remove_compact_method(corrector, compact_node); end + def map_method_and_compact_method_on_same_line?(compact_node); end + def remove_compact_method(corrector, compact_node, chained_method); end end RuboCop::Cop::Performance::MapCompact::MSG = T.let(T.unsafe(nil), String) @@ -586,6 +585,7 @@ class RuboCop::Cop::Performance::RedundantStringChars < ::RuboCop::Cop::Base def build_bad_method(method, args); end def build_call_args(call_args_node); end def build_good_method(method, args); end + def build_good_method_for_brackets_or_first_method(method, args); end def build_message(method, args); end def correction_range(receiver, node); end def offense_range(receiver, node); end @@ -734,6 +734,15 @@ end RuboCop::Cop::Performance::StartWith::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Performance::StartWith::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Performance::StringIdentifierArgument < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_send(node); end +end + +RuboCop::Cop::Performance::StringIdentifierArgument::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Performance::StringIdentifierArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Performance::StringInclude < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector From 510bc25db6bb843af6c3e359a111ae24c3433171 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 29 Dec 2021 13:07:39 +0000 Subject: [PATCH 4/4] brew style -fix --- Library/Homebrew/cmd/deps.rb | 2 +- Library/Homebrew/test/ENV_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index e3d660addd..534a49d1a8 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -81,7 +81,7 @@ module Homebrew Formulary.enable_factory_cache! - recursive = !args.send("1?") + recursive = !args.send(:"1?") installed = args.installed? || dependents(args.named.to_formulae_and_casks).all?(&:any_version_installed?) @use_runtime_dependencies = installed && recursive && diff --git a/Library/Homebrew/test/ENV_spec.rb b/Library/Homebrew/test/ENV_spec.rb index 7d1befdbbd..1f0632b12b 100644 --- a/Library/Homebrew/test/ENV_spec.rb +++ b/Library/Homebrew/test/ENV_spec.rb @@ -130,7 +130,7 @@ describe "ENV" do describe "#compiler" do it "allows switching compilers" do - subject.public_send("gcc-6") + subject.public_send(:"gcc-6") expect(subject.compiler).to eq("gcc-6") end end