diff --git a/Gemfile.lock b/Gemfile.lock index bfd4cc5a9d2..988baca4617 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -284,8 +284,8 @@ GEM image_processing (1.9.3) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.13, < 3) - jaro_winkler (1.5.3) - jaro_winkler (1.5.3-java) + jaro_winkler (1.5.4) + jaro_winkler (1.5.4-java) jdbc-mysql (5.1.47) jdbc-postgres (42.2.6) jdbc-sqlite3 (3.28.0) @@ -349,7 +349,7 @@ GEM nokogiri (1.10.4-x86-mingw32) mini_portile2 (~> 2.4.0) os (1.0.1) - parallel (1.18.0) + parallel (1.19.0) parser (2.6.5.0) ast (~> 2.4.0) path_expander (1.1.0) @@ -416,7 +416,7 @@ GEM rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) - rubocop-performance (1.5.0) + rubocop-performance (1.5.1) rubocop (>= 0.71.0) rubocop-rails (2.3.2) rack (>= 1.1) diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb index ec0c9ecc670..de8dca086aa 100644 --- a/actionpack/lib/action_controller/metal/http_authentication.rb +++ b/actionpack/lib/action_controller/metal/http_authentication.rb @@ -482,7 +482,7 @@ module ActionController def raw_params(auth) _raw_params = auth.sub(TOKEN_REGEX, "").split(/\s*#{AUTHN_PAIR_DELIMITERS}\s*/) - if !(%r{\A#{TOKEN_KEY}}.match?(_raw_params.first)) + if !_raw_params.first.start_with?(TOKEN_KEY) _raw_params[0] = "#{TOKEN_KEY}#{_raw_params.first}" end diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 01ced70575a..f7eced7bba3 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -594,8 +594,9 @@ module ActionController private def scrub_env!(env) - env.delete_if { |k, v| k.match?(/^(action_dispatch|rack)\.request/) } - env.delete_if { |k, v| k.match?(/^action_dispatch\.rescue/) } + env.delete_if do |k, _| + k.start_with?("rack.request", "action_dispatch.request", "action_dispatch.rescue") + end env["rack.input"] = StringIO.new env.delete "CONTENT_LENGTH" env.delete "RAW_POST_DATA" diff --git a/actionpack/test/dispatch/exception_wrapper_test.rb b/actionpack/test/dispatch/exception_wrapper_test.rb index 3c395ca5eed..a44bc81b2d5 100644 --- a/actionpack/test/dispatch/exception_wrapper_test.rb +++ b/actionpack/test/dispatch/exception_wrapper_test.rb @@ -21,7 +21,7 @@ module ActionDispatch setup do @cleaner = ActiveSupport::BacktraceCleaner.new @cleaner.remove_filters! - @cleaner.add_silencer { |line| !line.match?(/^lib/) } + @cleaner.add_silencer { |line| !line.start_with?("lib") } end test "#source_extracts fetches source fragments for every backtrace entry" do diff --git a/activerecord/lib/active_record/connection_adapters/mysql/column.rb b/activerecord/lib/active_record/connection_adapters/mysql/column.rb index fa1541019d1..c21529b0a8c 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/column.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/column.rb @@ -11,7 +11,7 @@ module ActiveRecord end def case_sensitive? - collation && !/_ci\z/.match?(collation) + collation && !collation.end_with?("_ci") end def auto_increment? diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index 953447457da..499c02d203c 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -415,8 +415,7 @@ module ActiveRecord @content_columns ||= columns.reject do |c| c.name == primary_key || c.name == inheritance_column || - c.name.end_with?("_id") || - c.name.end_with?("_count") + c.name.end_with?("_id", "_count") end end diff --git a/activesupport/lib/active_support/option_merger.rb b/activesupport/lib/active_support/option_merger.rb index ca8db2f35b4..efdfcf1d95a 100644 --- a/activesupport/lib/active_support/option_merger.rb +++ b/activesupport/lib/active_support/option_merger.rb @@ -5,7 +5,7 @@ require "active_support/core_ext/hash/deep_merge" module ActiveSupport class OptionMerger #:nodoc: instance_methods.each do |method| - undef_method(method) unless method.match?(/^(__|instance_eval|class|object_id)/) + undef_method(method) unless method.start_with?("__", "instance_eval", "class", "object_id") end def initialize(context, options) diff --git a/railties/lib/rails/code_statistics.rb b/railties/lib/rails/code_statistics.rb index aa5c0d0b5b2..cf7bca9d51e 100644 --- a/railties/lib/rails/code_statistics.rb +++ b/railties/lib/rails/code_statistics.rb @@ -44,7 +44,7 @@ class CodeStatistics #:nodoc: Dir.foreach(directory) do |file_name| path = "#{directory}/#{file_name}" - if File.directory?(path) && !(/^\./.match?(file_name)) + if File.directory?(path) && !file_name.start_with?(".") stats.add(calculate_directory_statistics(path, pattern)) elsif file_name&.match?(pattern) stats.add_by_file_path(path) diff --git a/railties/lib/rails/command/base.rb b/railties/lib/rails/command/base.rb index 415bab199fa..bdac076ede4 100644 --- a/railties/lib/rails/command/base.rb +++ b/railties/lib/rails/command/base.rb @@ -52,7 +52,7 @@ module Rails def inherited(base) #:nodoc: super - if base.name && !base.name.match?(/Base$/) + if base.name && !base.name.end_with?("Base") Rails::Command.subclasses << base end end diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index 1d3c947cb06..692e6a7ad28 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -233,7 +233,7 @@ module Rails # Invoke source_root so the default_source_root is set. base.source_root - if base.name && !base.name.match?(/Base$/) + if base.name && !base.name.end_with?("Base") Rails::Generators.subclasses << base Rails::Generators.templates_path.each do |path|