brew vendor-gems: commit updates.
This commit is contained in:
		
							parent
							
								
									8902075693
								
							
						
					
					
						commit
						4178247be4
					
				@ -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/ruby-progressbar-1.11.0/lib")
 | 
			
		||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.3.0/lib")
 | 
			
		||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.41.1/lib")
 | 
			
		||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.1/lib")
 | 
			
		||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.2/lib")
 | 
			
		||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.4/lib")
 | 
			
		||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.16.0/lib")
 | 
			
		||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib")
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,7 @@ module RuboCop
 | 
			
		||||
      #   # bad
 | 
			
		||||
      #   str.chars[0..2]
 | 
			
		||||
      #   str.chars.slice(0..2)
 | 
			
		||||
      #   str.chars.last
 | 
			
		||||
      #
 | 
			
		||||
      #   # good
 | 
			
		||||
      #   str[0..2].chars
 | 
			
		||||
@ -20,6 +21,7 @@ module RuboCop
 | 
			
		||||
      #   # good
 | 
			
		||||
      #   str[0]
 | 
			
		||||
      #   str[0...2].chars
 | 
			
		||||
      #   str[-1]
 | 
			
		||||
      #
 | 
			
		||||
      #   # bad
 | 
			
		||||
      #   str.chars.take(2)
 | 
			
		||||
@ -33,9 +35,8 @@ module RuboCop
 | 
			
		||||
      #   str.size
 | 
			
		||||
      #   str.empty?
 | 
			
		||||
      #
 | 
			
		||||
      #   # For example, if the receiver is a blank string, it will be incompatible.
 | 
			
		||||
      #   # For example, if the receiver is an empty string, it will be incompatible.
 | 
			
		||||
      #   # If a negative value is specified for the receiver, `nil` is returned.
 | 
			
		||||
      #   str.chars.last    # Incompatible with `str[-1]`.
 | 
			
		||||
      #   str.chars.last(2) # Incompatible with `str[-2..-1].chars`.
 | 
			
		||||
      #   str.chars.drop(2) # Incompatible with `str[2..-1].chars`.
 | 
			
		||||
      #
 | 
			
		||||
@ -44,7 +45,7 @@ module RuboCop
 | 
			
		||||
        extend AutoCorrector
 | 
			
		||||
 | 
			
		||||
        MSG = 'Use `%<good_method>s` instead of `%<bad_method>s`.'
 | 
			
		||||
        RESTRICT_ON_SEND = %i[[] slice first take length size empty?].freeze
 | 
			
		||||
        RESTRICT_ON_SEND = %i[[] slice first last take length size empty?].freeze
 | 
			
		||||
 | 
			
		||||
        def_node_matcher :redundant_chars_call?, <<~PATTERN
 | 
			
		||||
          (send $(send _ :chars) $_ $...)
 | 
			
		||||
@ -52,6 +53,7 @@ module RuboCop
 | 
			
		||||
 | 
			
		||||
        def on_send(node)
 | 
			
		||||
          return unless (receiver, method, args = redundant_chars_call?(node))
 | 
			
		||||
          return if method == :last && !args.empty?
 | 
			
		||||
 | 
			
		||||
          range = offense_range(receiver, node)
 | 
			
		||||
          message = build_message(method, args)
 | 
			
		||||
@ -86,6 +88,8 @@ module RuboCop
 | 
			
		||||
            "[#{build_call_args(args)}].chars"
 | 
			
		||||
          when :[], :first
 | 
			
		||||
            build_good_method_for_brackets_or_first_method(method, args)
 | 
			
		||||
          when :last
 | 
			
		||||
            '[-1]'
 | 
			
		||||
          when :take
 | 
			
		||||
            "[0...#{args.first.source}].chars"
 | 
			
		||||
          else
 | 
			
		||||
@ -124,8 +124,8 @@ module RuboCop
 | 
			
		||||
 | 
			
		||||
        def_node_search :last_matches, <<~PATTERN
 | 
			
		||||
          {
 | 
			
		||||
            (send (const nil? :Regexp) :last_match)
 | 
			
		||||
            (send (const nil? :Regexp) :last_match _)
 | 
			
		||||
            (send (const {nil? cbase} :Regexp) :last_match)
 | 
			
		||||
            (send (const {nil? cbase} :Regexp) :last_match _)
 | 
			
		||||
            ({back_ref nth_ref} _)
 | 
			
		||||
            (gvar #match_gvar?)
 | 
			
		||||
          }
 | 
			
		||||
@ -22,11 +22,11 @@ module RuboCop
 | 
			
		||||
      class StringInclude < Base
 | 
			
		||||
        extend AutoCorrector
 | 
			
		||||
 | 
			
		||||
        MSG = 'Use `String#include?` instead of a regex match with literal-only pattern.'
 | 
			
		||||
        RESTRICT_ON_SEND = %i[match =~ match?].freeze
 | 
			
		||||
        MSG = 'Use `%<negation>sString#include?` instead of a regex match with literal-only pattern.'
 | 
			
		||||
        RESTRICT_ON_SEND = %i[match =~ !~ match?].freeze
 | 
			
		||||
 | 
			
		||||
        def_node_matcher :redundant_regex?, <<~PATTERN
 | 
			
		||||
          {(send $!nil? {:match :=~ :match?} (regexp (str $#literal?) (regopt)))
 | 
			
		||||
          {(send $!nil? {:match :=~ :!~ :match?} (regexp (str $#literal?) (regopt)))
 | 
			
		||||
           (send (regexp (str $#literal?) (regopt)) {:match :match?} $str)
 | 
			
		||||
           (match-with-lvasgn (regexp (str $#literal?) (regopt)) $_)}
 | 
			
		||||
        PATTERN
 | 
			
		||||
@ -34,11 +34,14 @@ module RuboCop
 | 
			
		||||
        def on_send(node)
 | 
			
		||||
          return unless (receiver, regex_str = redundant_regex?(node))
 | 
			
		||||
 | 
			
		||||
          add_offense(node) do |corrector|
 | 
			
		||||
          negation = node.send_type? && node.method?(:!~)
 | 
			
		||||
          message = format(MSG, negation: ('!' if negation))
 | 
			
		||||
 | 
			
		||||
          add_offense(node, message: message) do |corrector|
 | 
			
		||||
            receiver, regex_str = regex_str, receiver if receiver.is_a?(String)
 | 
			
		||||
            regex_str = interpret_string_escapes(regex_str)
 | 
			
		||||
 | 
			
		||||
            new_source = "#{receiver.source}.include?(#{to_string_literal(regex_str)})"
 | 
			
		||||
            new_source = "#{'!' if negation}#{receiver.source}.include?(#{to_string_literal(regex_str)})"
 | 
			
		||||
 | 
			
		||||
            corrector.replace(node.source_range, new_source)
 | 
			
		||||
          end
 | 
			
		||||
@ -70,6 +70,9 @@ module RuboCop
 | 
			
		||||
      class Sum < Base
 | 
			
		||||
        include RangeHelp
 | 
			
		||||
        extend AutoCorrector
 | 
			
		||||
        extend TargetRubyVersion
 | 
			
		||||
 | 
			
		||||
        minimum_target_ruby_version 2.4
 | 
			
		||||
 | 
			
		||||
        MSG = 'Use `%<good_method>s` instead of `%<bad_method>s`.'
 | 
			
		||||
        MSG_IF_NO_INIT_VALUE =
 | 
			
		||||
@ -4,7 +4,7 @@ module RuboCop
 | 
			
		||||
  module Performance
 | 
			
		||||
    # This module holds the RuboCop Performance version information.
 | 
			
		||||
    module Version
 | 
			
		||||
      STRING = '1.15.1'
 | 
			
		||||
      STRING = '1.15.2'
 | 
			
		||||
 | 
			
		||||
      def self.document_version
 | 
			
		||||
        STRING.match('\d+\.\d+').to_s
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user