Merge pull request #14528 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-performance-1.16.0

build(deps): bump rubocop-performance from 1.15.2 to 1.16.0 in /Library/Homebrew
This commit is contained in:
Mike McQuaid 2023-02-07 19:28:40 +01:00 committed by GitHub
commit b761344428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 27 additions and 27 deletions

View File

@ -72,8 +72,8 @@ SimpleCov.start do
require "rbconfig" require "rbconfig"
host_os = RbConfig::CONFIG["host_os"] host_os = RbConfig::CONFIG["host_os"]
add_filter %r{/os/mac} unless /darwin/.match?(host_os) add_filter %r{/os/mac} unless host_os.include?("darwin")
add_filter %r{/os/linux} unless /linux/.match?(host_os) add_filter %r{/os/linux} unless host_os.include?("linux")
# Add groups and the proper project name to the output. # Add groups and the proper project name to the output.
project_name "Homebrew" project_name "Homebrew"

View File

@ -144,7 +144,7 @@ GEM
parser (>= 3.1.1.0) parser (>= 3.1.1.0)
rubocop-capybara (2.17.0) rubocop-capybara (2.17.0)
rubocop (~> 1.41) rubocop (~> 1.41)
rubocop-performance (1.15.2) rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0) rubocop-ast (>= 0.4.0)
rubocop-rails (2.17.4) rubocop-rails (2.17.4)

View File

@ -44,8 +44,8 @@ module SystemConfig
return unless /-microsoft/i.match?(kernel) return unless /-microsoft/i.match?(kernel)
return "2 (Microsoft Store)" if Version.new(kernel[/Linux ([0-9.]*)-.*/, 1]) > Version.new("5.15") return "2 (Microsoft Store)" if Version.new(kernel[/Linux ([0-9.]*)-.*/, 1]) > Version.new("5.15")
return "2" if /-microsoft/.match?(kernel) return "2" if kernel.include?("-microsoft")
return "1" if /-Microsoft/.match?(kernel) return "1" if kernel.include?("-Microsoft")
end end
def dump_verbose_config(out = $stdout) def dump_verbose_config(out = $stdout)

View File

@ -49,7 +49,7 @@ module FormulaCellarChecks
python_modules = Pathname.glob lib/"python*/site-packages/**/*.so" python_modules = Pathname.glob lib/"python*/site-packages/**/*.so"
framework_links = python_modules.select do |obj| framework_links = python_modules.select do |obj|
dlls = obj.dynamically_linked_libraries dlls = obj.dynamically_linked_libraries
dlls.any? { |dll| /Python\.framework/.match dll } dlls.any? { |dll| dll.include?("Python.framework") }
end end
return if framework_links.empty? return if framework_links.empty?

View File

@ -508,6 +508,7 @@ RuboCop::Cop::Performance::RedundantMatch::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::Performance::RedundantMatch::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) RuboCop::Cop::Performance::RedundantMatch::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
class RuboCop::Cop::Performance::RedundantMerge < ::RuboCop::Cop::Base class RuboCop::Cop::Performance::RedundantMerge < ::RuboCop::Cop::Base
include ::RuboCop::Cop::Alignment
extend ::RuboCop::Cop::AutoCorrector extend ::RuboCop::Cop::AutoCorrector
def modifier_flow_control?(param0 = T.unsafe(nil)); end def modifier_flow_control?(param0 = T.unsafe(nil)); end
@ -519,7 +520,6 @@ class RuboCop::Cop::Performance::RedundantMerge < ::RuboCop::Cop::Base
def correct_multiple_elements(corrector, node, parent, new_source); end def correct_multiple_elements(corrector, node, parent, new_source); end
def correct_single_element(corrector, node, new_source); end def correct_single_element(corrector, node, new_source); end
def each_redundant_merge(node); end def each_redundant_merge(node); end
def indent_width; end
def kwsplat_used?(pairs); end def kwsplat_used?(pairs); end
def leading_spaces(node); end def leading_spaces(node); end
def max_key_value_pairs; end def max_key_value_pairs; end

View File

@ -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/unicode-display_width-2.4.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.44.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.44.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-capybara-2.17.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-capybara-2.17.0/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-performance-1.16.0/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-rails-2.17.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.18.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.18.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.7.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.7.0/lib")

View File

@ -33,7 +33,7 @@ module RuboCop
RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = %i[zip product].to_set.freeze RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = %i[zip product].to_set.freeze
# These methods ALWAYS return a new array # These methods ALWAYS return a new array
# after they're called it's safe to mutate the the resulting array # after they're called it's safe to mutate the resulting array
ALWAYS_RETURNS_NEW_ARRAY = %i[* + - collect compact drop ALWAYS_RETURNS_NEW_ARRAY = %i[* + - collect compact drop
drop_while flatten map reject drop_while flatten map reject
reverse rotate select shuffle sort reverse rotate select shuffle sort

View File

@ -8,9 +8,12 @@ module RuboCop
# `detect` instead. # `detect` instead.
# #
# @safety # @safety
# This cop is unsafe because is has known compatibility issues with `ActiveRecord` and other # This cop is unsafe because is assumes the class implements the
# frameworks. `ActiveRecord` does not implement a `detect` method and `find` has its own # `Enumerable` interface, but can't reliably detect this. This creates
# meaning. Correcting `ActiveRecord` methods with this cop should be considered unsafe. # 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.
# #
# @example # @example
# # bad # # bad

View File

@ -28,6 +28,7 @@ module RuboCop
# hash[:a] = 1 # hash[:a] = 1
# hash[:b] = 2 # hash[:b] = 2
class RedundantMerge < Base class RedundantMerge < Base
include Alignment
extend AutoCorrector extend AutoCorrector
AREF_ASGN = '%<receiver>s[%<key>s] = %<value>s' AREF_ASGN = '%<receiver>s[%<key>s] = %<value>s'
@ -129,7 +130,7 @@ module RuboCop
end end
def rewrite_with_modifier(node, parent, new_source) def rewrite_with_modifier(node, parent, new_source)
indent = ' ' * indent_width indent = ' ' * configured_indentation_width
padding = "\n#{indent + leading_spaces(node)}" padding = "\n#{indent + leading_spaces(node)}"
new_source.gsub!(/\n/, padding) new_source.gsub!(/\n/, padding)
@ -144,10 +145,6 @@ module RuboCop
node.source_range.source_line[/\A\s*/] node.source_range.source_line[/\A\s*/]
end end
def indent_width
@config.for_cop('Layout/IndentationWidth')['Width'] || 2
end
def max_key_value_pairs def max_key_value_pairs
Integer(cop_config['MaxKeyValuePairs'] || 2) Integer(cop_config['MaxKeyValuePairs'] || 2)
end end

View File

@ -6,19 +6,19 @@ module RuboCop
# Identifies unnecessary use of a regex where `String#include?` would suffice. # Identifies unnecessary use of a regex where `String#include?` would suffice.
# #
# @safety # @safety
# This cop's offenses are not safe to autocorrect if a receiver is nil. # This cop's offenses are not safe to autocorrect if a receiver is nil or a Symbol.
# #
# @example # @example
# # bad # # bad
# 'abc'.match?(/ab/) # str.match?(/ab/)
# /ab/.match?('abc') # /ab/.match?(str)
# 'abc' =~ /ab/ # str =~ /ab/
# /ab/ =~ 'abc' # /ab/ =~ str
# 'abc'.match(/ab/) # str.match(/ab/)
# /ab/.match('abc') # /ab/.match(str)
# #
# # good # # good
# 'abc'.include?('ab') # str.include?('ab')
class StringInclude < Base class StringInclude < Base
extend AutoCorrector extend AutoCorrector
@ -27,7 +27,7 @@ module RuboCop
def_node_matcher :redundant_regex?, <<~PATTERN 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) (send (regexp (str $#literal?) (regopt)) {:match :match?} $_)
(match-with-lvasgn (regexp (str $#literal?) (regopt)) $_)} (match-with-lvasgn (regexp (str $#literal?) (regopt)) $_)}
PATTERN PATTERN

View File

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