Skip to content

Commit

Permalink
Merge pull request rails#47262 from koic/bump_rubocop_performance_to_…
Browse files Browse the repository at this point in the history
…1_16_0

Use RuboCop Performance 1.16.0
  • Loading branch information
eileencodes authored Feb 6, 2023
2 parents fd7c379 + 5726b1d commit 36d8a1c
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/routing/mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def check_part(name, part, path_params, hash)
end

def split_to(to)
if /#/.match?(to)
if to&.include?("#")
to.split("#").map!(&:-@)
else
[]
Expand Down Expand Up @@ -1640,7 +1640,7 @@ def match(path, *rest, &block)
when Symbol
options[:action] = to
when String
if /#/.match?(to)
if to.include?("#")
options[:to] = to
else
options[:controller] = to
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/routing/route_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ def call(env)

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
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/testing/assertions/routing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def assert_recognizes(expected_options, path, extras = {}, msg = nil)
# # 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
Expand Down Expand Up @@ -202,7 +202,7 @@ def recognized_request_for(path, extras = {}, msg)
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"
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/testing/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def process(method, path, params: nil, headers: nil, env: nil, xhr: false, as: n
method = :post
end

if %r{://}.match?(path)
if path.include?("://")
path = build_expanded_path(path) do |location|
https! URI::HTTPS === location if location.scheme

Expand Down
2 changes: 1 addition & 1 deletion actiontext/bin/webpack
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion actiontext/bin/webpack-dev-server
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def quoted_binary(value) # :nodoc:
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)
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/commands/secrets/secrets_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def edit
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
Expand Down

0 comments on commit 36d8a1c

Please sign in to comment.