mirror of https://github.com/rails/rails
Address all possible `Performance/StartWith` / `Performance/EndWith` violations
rubocop-performance v1.5.1 includes bug fixes for that cops. https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.5.1
This commit is contained in:
parent
081dfef95a
commit
ad767034c9
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,7 +11,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def case_sensitive?
|
||||
collation && !/_ci\z/.match?(collation)
|
||||
collation && !collation.end_with?("_ci")
|
||||
end
|
||||
|
||||
def auto_increment?
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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|
|
||||
|
|
Loading…
Reference in New Issue