Merge pull request #47262 from koic/bump_rubocop_performance_to_1_16_0

Use RuboCop Performance 1.16.0
This commit is contained in:
Eileen M. Uchitelle 2023-02-06 09:21:43 -05:00 committed by GitHub
commit 36d8a1ce52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 11 deletions

View File

@ -410,7 +410,7 @@ GEM
rubocop (>= 0.90, < 2.0)
rubocop-packaging (0.5.2)
rubocop (>= 1.33, < 2.0)
rubocop-performance (1.15.2)
rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.17.4)

View File

@ -306,7 +306,7 @@ module ActionDispatch
end
def split_to(to)
if /#/.match?(to)
if to&.include?("#")
to.split("#").map!(&:-@)
else
[]
@ -1640,7 +1640,7 @@ module ActionDispatch
when Symbol
options[:action] = to
when String
if /#/.match?(to)
if to.include?("#")
options[:to] = to
else
options[:controller] = to

View File

@ -884,7 +884,7 @@ module ActionDispatch
def recognize_path(path, environment = {})
method = (environment[:method] || "GET").to_s.upcase
path = Journey::Router::Utils.normalize_path(path) unless %r{://}.match?(path)
path = Journey::Router::Utils.normalize_path(path) unless path.include?("://")
extras = environment[:extras] || {}
begin

View File

@ -83,7 +83,7 @@ module ActionDispatch
# # Asserts that the generated route gives us our custom route
# assert_generates "changesets/12", { controller: 'scm', action: 'show_diff', revision: "12" }
def assert_generates(expected_path, options, defaults = {}, extras = {}, message = nil)
if %r{://}.match?(expected_path)
if expected_path.include?("://")
fail_on(URI::InvalidURIError, message) do
uri = URI.parse(expected_path)
expected_path = uri.path.to_s.empty? ? "/" : uri.path
@ -202,7 +202,7 @@ module ActionDispatch
controller = @controller if defined?(@controller)
request = ActionController::TestRequest.create controller&.class
if %r{://}.match?(path)
if path.include?("://")
fail_on(URI::InvalidURIError, msg) do
uri = URI.parse(path)
request.env["rack.url_scheme"] = uri.scheme || "http"

View File

@ -232,7 +232,7 @@ module ActionDispatch
method = :post
end
if %r{://}.match?(path)
if path.include?("://")
path = build_expanded_path(path) do |location|
https! URI::HTTPS === location if location.scheme

View File

@ -15,7 +15,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
if File.read(bundle_binstub, 150).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.

View File

@ -15,7 +15,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
if File.read(bundle_binstub, 150).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.

View File

@ -117,7 +117,7 @@ module ActiveRecord
def quote_default_expression(value, column) # :nodoc:
if value.is_a?(Proc)
value.call
elsif column.type == :uuid && value.is_a?(String) && /\(\)/.match?(value)
elsif column.type == :uuid && value.is_a?(String) && value.include?("()")
value # Does not quote function default values for UUID columns
elsif column.respond_to?(:array?)
type = lookup_cast_type_from_column(column)

View File

@ -25,7 +25,7 @@ module Rails
rescue Rails::Secrets::MissingKeyError => error
say error.message
rescue Errno::ENOENT => error
if /secrets\.yml\.enc/.match?(error.message)
if error.message.include?("secrets.yml.enc")
deprecate_in_favor_of_credentials_and_exit
else
raise