diff --git a/Gemfile.lock b/Gemfile.lock index 3a9cf962197..2d5a87106d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 946c4e48228..bbe817c72ce 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -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 diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 7cb1bef06ac..4a13de98bc8 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -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 diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb index ddd93959852..42e82151cd8 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb @@ -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" diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index a4c368e1fbb..43b606cda8b 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -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 diff --git a/actiontext/bin/webpack b/actiontext/bin/webpack index ac2adfb6b99..ac959ee7e53 100755 --- a/actiontext/bin/webpack +++ b/actiontext/bin/webpack @@ -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. diff --git a/actiontext/bin/webpack-dev-server b/actiontext/bin/webpack-dev-server index c1ac52d675e..54b03c0b9f9 100755 --- a/actiontext/bin/webpack-dev-server +++ b/actiontext/bin/webpack-dev-server @@ -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. diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index 33090461c3b..7e15e95894e 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -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) diff --git a/railties/lib/rails/commands/secrets/secrets_command.rb b/railties/lib/rails/commands/secrets/secrets_command.rb index c379e6ce8c3..5470e444422 100644 --- a/railties/lib/rails/commands/secrets/secrets_command.rb +++ b/railties/lib/rails/commands/secrets/secrets_command.rb @@ -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