Merge pull request #32381 from q-centrix/update-codeclimate-configs
Turn on performance based cops
This commit is contained in:
commit
91fd679710
|
@ -179,3 +179,12 @@ Style/Semicolon:
|
||||||
# Prefer Foo.method over Foo::method
|
# Prefer Foo.method over Foo::method
|
||||||
Style/ColonMethodCall:
|
Style/ColonMethodCall:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Style/TrivialAccessors:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Performance/FlatMap:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Performance/RedundantMerge:
|
||||||
|
Enabled: true
|
||||||
|
|
|
@ -40,9 +40,7 @@ module ActionMailer
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def message
|
attr_reader :message
|
||||||
@message
|
|
||||||
end
|
|
||||||
|
|
||||||
def html_part
|
def html_part
|
||||||
@html_part ||= message.html_part
|
@html_part ||= message.html_part
|
||||||
|
|
|
@ -793,9 +793,7 @@ module ActionController
|
||||||
protected
|
protected
|
||||||
attr_reader :parameters
|
attr_reader :parameters
|
||||||
|
|
||||||
def permitted=(new_permitted)
|
attr_writer :permitted
|
||||||
@permitted = new_permitted
|
|
||||||
end
|
|
||||||
|
|
||||||
def fields_for_style?
|
def fields_for_style?
|
||||||
@parameters.all? { |k, v| k =~ /\A-?\d+\z/ && (v.is_a?(Hash) || v.is_a?(Parameters)) }
|
@parameters.all? { |k, v| k =~ /\A-?\d+\z/ && (v.is_a?(Hash) || v.is_a?(Parameters)) }
|
||||||
|
|
|
@ -272,7 +272,7 @@ class HttpDigestAuthenticationTest < ActionController::TestCase
|
||||||
credentials.merge!(options)
|
credentials.merge!(options)
|
||||||
path_info = @request.env["PATH_INFO"].to_s
|
path_info = @request.env["PATH_INFO"].to_s
|
||||||
uri = options[:uri] || path_info
|
uri = options[:uri] || path_info
|
||||||
credentials.merge!(uri: uri)
|
credentials[:uri] = uri
|
||||||
@request.env["ORIGINAL_FULLPATH"] = path_info
|
@request.env["ORIGINAL_FULLPATH"] = path_info
|
||||||
ActionController::HttpAuthentication::Digest.encode_credentials(method, credentials, password, options[:password_is_ha1])
|
ActionController::HttpAuthentication::Digest.encode_credentials(method, credentials, password, options[:password_is_ha1])
|
||||||
end
|
end
|
||||||
|
|
|
@ -82,9 +82,7 @@ module Another
|
||||||
@last_payload = payload
|
@last_payload = payload
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_payload
|
attr_reader :last_payload
|
||||||
@last_payload
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1322,7 +1322,7 @@ class ResourcesTest < ActionController::TestCase
|
||||||
def assert_resource_allowed_routes(controller, options, shallow_options, allowed, not_allowed, path = controller)
|
def assert_resource_allowed_routes(controller, options, shallow_options, allowed, not_allowed, path = controller)
|
||||||
shallow_path = "#{path}/#{shallow_options[:id]}"
|
shallow_path = "#{path}/#{shallow_options[:id]}"
|
||||||
format = options[:format] && ".#{options[:format]}"
|
format = options[:format] && ".#{options[:format]}"
|
||||||
options.merge!(controller: controller)
|
options[:controller] = controller
|
||||||
shallow_options.merge!(options)
|
shallow_options.merge!(options)
|
||||||
|
|
||||||
assert_whether_allowed(allowed, not_allowed, options, "index", "#{path}#{format}", :get)
|
assert_whether_allowed(allowed, not_allowed, options, "index", "#{path}#{format}", :get)
|
||||||
|
@ -1336,7 +1336,7 @@ class ResourcesTest < ActionController::TestCase
|
||||||
|
|
||||||
def assert_singleton_resource_allowed_routes(controller, options, allowed, not_allowed, path = controller.singularize)
|
def assert_singleton_resource_allowed_routes(controller, options, allowed, not_allowed, path = controller.singularize)
|
||||||
format = options[:format] && ".#{options[:format]}"
|
format = options[:format] && ".#{options[:format]}"
|
||||||
options.merge!(controller: controller)
|
options[:controller] = controller
|
||||||
|
|
||||||
assert_whether_allowed(allowed, not_allowed, options, "new", "#{path}/new#{format}", :get)
|
assert_whether_allowed(allowed, not_allowed, options, "new", "#{path}/new#{format}", :get)
|
||||||
assert_whether_allowed(allowed, not_allowed, options, "create", "#{path}#{format}", :post)
|
assert_whether_allowed(allowed, not_allowed, options, "create", "#{path}#{format}", :post)
|
||||||
|
|
|
@ -105,16 +105,20 @@ class HeaderTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test "#merge! headers with mutation" do
|
test "#merge! headers with mutation" do
|
||||||
|
# rubocop:disable Performance/RedundantMerge
|
||||||
@headers.merge!("Host" => "http://example.test",
|
@headers.merge!("Host" => "http://example.test",
|
||||||
"Content-Type" => "text/html")
|
"Content-Type" => "text/html")
|
||||||
|
# rubocop:enable Performance/RedundantMerge
|
||||||
assert_equal({ "HTTP_HOST" => "http://example.test",
|
assert_equal({ "HTTP_HOST" => "http://example.test",
|
||||||
"CONTENT_TYPE" => "text/html",
|
"CONTENT_TYPE" => "text/html",
|
||||||
"HTTP_REFERER" => "/some/page" }, @headers.env)
|
"HTTP_REFERER" => "/some/page" }, @headers.env)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "#merge! env with mutation" do
|
test "#merge! env with mutation" do
|
||||||
|
# rubocop:disable Performance/RedundantMerge
|
||||||
@headers.merge!("HTTP_HOST" => "http://first.com",
|
@headers.merge!("HTTP_HOST" => "http://first.com",
|
||||||
"CONTENT_TYPE" => "text/html")
|
"CONTENT_TYPE" => "text/html")
|
||||||
|
# rubocop:enable Performance/RedundantMerge
|
||||||
assert_equal({ "HTTP_HOST" => "http://first.com",
|
assert_equal({ "HTTP_HOST" => "http://first.com",
|
||||||
"CONTENT_TYPE" => "text/html",
|
"CONTENT_TYPE" => "text/html",
|
||||||
"HTTP_REFERER" => "/some/page" }, @headers.env)
|
"HTTP_REFERER" => "/some/page" }, @headers.env)
|
||||||
|
@ -156,7 +160,7 @@ class HeaderTest < ActiveSupport::TestCase
|
||||||
env = { "HTTP_REFERER" => "/" }
|
env = { "HTTP_REFERER" => "/" }
|
||||||
headers = make_headers(env)
|
headers = make_headers(env)
|
||||||
headers["Referer"] = "http://example.com/"
|
headers["Referer"] = "http://example.com/"
|
||||||
headers.merge! "CONTENT_TYPE" => "text/plain"
|
headers["CONTENT_TYPE"] = "text/plain"
|
||||||
assert_equal({ "HTTP_REFERER" => "http://example.com/",
|
assert_equal({ "HTTP_REFERER" => "http://example.com/",
|
||||||
"CONTENT_TYPE" => "text/plain" }, env)
|
"CONTENT_TYPE" => "text/plain" }, env)
|
||||||
end
|
end
|
||||||
|
|
|
@ -318,7 +318,8 @@ class FormWithActsLikeFormForTest < FormWithTest
|
||||||
@url_for_options = object
|
@url_for_options = object
|
||||||
|
|
||||||
if object.is_a?(Hash) && object[:use_route].blank? && object[:controller].blank?
|
if object.is_a?(Hash) && object[:use_route].blank? && object[:controller].blank?
|
||||||
object.merge!(controller: "main", action: "index")
|
object[:controller] = "main"
|
||||||
|
object[:action] = "index"
|
||||||
end
|
end
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
|
@ -168,7 +168,8 @@ class FormHelperTest < ActionView::TestCase
|
||||||
@url_for_options = object
|
@url_for_options = object
|
||||||
|
|
||||||
if object.is_a?(Hash) && object[:use_route].blank? && object[:controller].blank?
|
if object.is_a?(Hash) && object[:use_route].blank? && object[:controller].blank?
|
||||||
object.merge!(controller: "main", action: "index")
|
object[:controller] = "main"
|
||||||
|
object[:action] = "index"
|
||||||
end
|
end
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
|
@ -14,37 +14,23 @@ class DirtyTest < ActiveModel::TestCase
|
||||||
@status = "initialized"
|
@status = "initialized"
|
||||||
end
|
end
|
||||||
|
|
||||||
def name
|
attr_reader :name, :color, :size, :status
|
||||||
@name
|
|
||||||
end
|
|
||||||
|
|
||||||
def name=(val)
|
def name=(val)
|
||||||
name_will_change!
|
name_will_change!
|
||||||
@name = val
|
@name = val
|
||||||
end
|
end
|
||||||
|
|
||||||
def color
|
|
||||||
@color
|
|
||||||
end
|
|
||||||
|
|
||||||
def color=(val)
|
def color=(val)
|
||||||
color_will_change! unless val == @color
|
color_will_change! unless val == @color
|
||||||
@color = val
|
@color = val
|
||||||
end
|
end
|
||||||
|
|
||||||
def size
|
|
||||||
@size
|
|
||||||
end
|
|
||||||
|
|
||||||
def size=(val)
|
def size=(val)
|
||||||
attribute_will_change!(:size) unless val == @size
|
attribute_will_change!(:size) unless val == @size
|
||||||
@size = val
|
@size = val
|
||||||
end
|
end
|
||||||
|
|
||||||
def status
|
|
||||||
@status
|
|
||||||
end
|
|
||||||
|
|
||||||
def status=(val)
|
def status=(val)
|
||||||
status_will_change! unless val == @status
|
status_will_change! unless val == @status
|
||||||
@status = val
|
@status = val
|
||||||
|
|
|
@ -57,9 +57,7 @@ module ActiveRecord
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def uri
|
attr_reader :uri
|
||||||
@uri
|
|
||||||
end
|
|
||||||
|
|
||||||
def uri_parser
|
def uri_parser
|
||||||
@uri_parser ||= URI::Parser.new
|
@uri_parser ||= URI::Parser.new
|
||||||
|
|
|
@ -36,7 +36,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
indexes.last[-2] << row[:Column_name]
|
indexes.last[-2] << row[:Column_name]
|
||||||
indexes.last[-1][:lengths].merge!(row[:Column_name] => row[:Sub_part].to_i) if row[:Sub_part]
|
indexes.last[-1][:lengths][row[:Column_name]] = row[:Sub_part].to_i if row[:Sub_part]
|
||||||
indexes.last[-1][:orders].merge!(row[:Column_name] => :desc) if row[:Collation] == "D"
|
indexes.last[-1][:orders].merge!(row[:Column_name] => :desc) if row[:Collation] == "D"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -117,7 +117,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure_connection
|
def configure_connection
|
||||||
@connection.query_options.merge!(as: :array)
|
@connection.query_options[:as] = :array
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,7 @@ module ActiveRecord
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def configuration
|
attr_reader :configuration
|
||||||
@configuration
|
|
||||||
end
|
|
||||||
|
|
||||||
def configuration_without_database
|
def configuration_without_database
|
||||||
configuration.merge("database" => nil)
|
configuration.merge("database" => nil)
|
||||||
|
|
|
@ -90,9 +90,7 @@ module ActiveRecord
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def configuration
|
attr_reader :configuration
|
||||||
@configuration
|
|
||||||
end
|
|
||||||
|
|
||||||
def encoding
|
def encoding
|
||||||
configuration["encoding"] || DEFAULT_ENCODING
|
configuration["encoding"] || DEFAULT_ENCODING
|
||||||
|
|
|
@ -60,13 +60,7 @@ module ActiveRecord
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def configuration
|
attr_reader :configuration, :root
|
||||||
@configuration
|
|
||||||
end
|
|
||||||
|
|
||||||
def root
|
|
||||||
@root
|
|
||||||
end
|
|
||||||
|
|
||||||
def run_cmd(cmd, args, out)
|
def run_cmd(cmd, args, out)
|
||||||
fail run_cmd_error(cmd, args) unless Kernel.system(cmd, *args, out: out)
|
fail run_cmd_error(cmd, args) unless Kernel.system(cmd, *args, out: out)
|
||||||
|
|
|
@ -187,7 +187,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
relation = Relation.new(klass)
|
relation = Relation.new(klass)
|
||||||
relation.merge!(where: ["foo = ?", "bar"])
|
relation.merge!(where: ["foo = ?", "bar"]) # rubocop:disable Performance/RedundantMerge
|
||||||
assert_equal Relation::WhereClause.new(["foo = bar"]), relation.where_clause
|
assert_equal Relation::WhereClause.new(["foo = bar"]), relation.where_clause
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ignores_configurations_without_databases
|
def test_ignores_configurations_without_databases
|
||||||
@configurations["development"].merge!("database" => nil)
|
@configurations["development"]["database"] = nil
|
||||||
|
|
||||||
with_stubbed_configurations_establish_connection do
|
with_stubbed_configurations_establish_connection do
|
||||||
assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
||||||
|
@ -162,7 +162,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ignores_remote_databases
|
def test_ignores_remote_databases
|
||||||
@configurations["development"].merge!("host" => "my.server.tld")
|
@configurations["development"]["host"] = "my.server.tld"
|
||||||
|
|
||||||
with_stubbed_configurations_establish_connection do
|
with_stubbed_configurations_establish_connection do
|
||||||
assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
||||||
|
@ -172,7 +172,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_warning_for_remote_databases
|
def test_warning_for_remote_databases
|
||||||
@configurations["development"].merge!("host" => "my.server.tld")
|
@configurations["development"]["host"] = "my.server.tld"
|
||||||
|
|
||||||
with_stubbed_configurations_establish_connection do
|
with_stubbed_configurations_establish_connection do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.create_all
|
ActiveRecord::Tasks::DatabaseTasks.create_all
|
||||||
|
@ -183,7 +183,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_creates_configurations_with_local_ip
|
def test_creates_configurations_with_local_ip
|
||||||
@configurations["development"].merge!("host" => "127.0.0.1")
|
@configurations["development"]["host"] = "127.0.0.1"
|
||||||
|
|
||||||
with_stubbed_configurations_establish_connection do
|
with_stubbed_configurations_establish_connection do
|
||||||
assert_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
assert_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
||||||
|
@ -193,7 +193,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_creates_configurations_with_local_host
|
def test_creates_configurations_with_local_host
|
||||||
@configurations["development"].merge!("host" => "localhost")
|
@configurations["development"]["host"] = "localhost"
|
||||||
|
|
||||||
with_stubbed_configurations_establish_connection do
|
with_stubbed_configurations_establish_connection do
|
||||||
assert_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
assert_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
||||||
|
@ -203,7 +203,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_creates_configurations_with_blank_hosts
|
def test_creates_configurations_with_blank_hosts
|
||||||
@configurations["development"].merge!("host" => nil)
|
@configurations["development"]["host"] = nil
|
||||||
|
|
||||||
with_stubbed_configurations_establish_connection do
|
with_stubbed_configurations_establish_connection do
|
||||||
assert_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
assert_called(ActiveRecord::Tasks::DatabaseTasks, :create) do
|
||||||
|
@ -463,7 +463,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ignores_configurations_without_databases
|
def test_ignores_configurations_without_databases
|
||||||
@configurations[:development].merge!("database" => nil)
|
@configurations[:development]["database"] = nil
|
||||||
|
|
||||||
ActiveRecord::Base.stub(:configurations, @configurations) do
|
ActiveRecord::Base.stub(:configurations, @configurations) do
|
||||||
assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
||||||
|
@ -473,7 +473,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ignores_remote_databases
|
def test_ignores_remote_databases
|
||||||
@configurations[:development].merge!("host" => "my.server.tld")
|
@configurations[:development]["host"] = "my.server.tld"
|
||||||
|
|
||||||
ActiveRecord::Base.stub(:configurations, @configurations) do
|
ActiveRecord::Base.stub(:configurations, @configurations) do
|
||||||
assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
assert_not_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
||||||
|
@ -483,7 +483,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_warning_for_remote_databases
|
def test_warning_for_remote_databases
|
||||||
@configurations[:development].merge!("host" => "my.server.tld")
|
@configurations[:development]["host"] = "my.server.tld"
|
||||||
|
|
||||||
ActiveRecord::Base.stub(:configurations, @configurations) do
|
ActiveRecord::Base.stub(:configurations, @configurations) do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
||||||
|
@ -494,7 +494,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_drops_configurations_with_local_ip
|
def test_drops_configurations_with_local_ip
|
||||||
@configurations[:development].merge!("host" => "127.0.0.1")
|
@configurations[:development]["host"] = "127.0.0.1"
|
||||||
|
|
||||||
ActiveRecord::Base.stub(:configurations, @configurations) do
|
ActiveRecord::Base.stub(:configurations, @configurations) do
|
||||||
assert_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
assert_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
||||||
|
@ -504,7 +504,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_drops_configurations_with_local_host
|
def test_drops_configurations_with_local_host
|
||||||
@configurations[:development].merge!("host" => "localhost")
|
@configurations[:development]["host"] = "localhost"
|
||||||
|
|
||||||
ActiveRecord::Base.stub(:configurations, @configurations) do
|
ActiveRecord::Base.stub(:configurations, @configurations) do
|
||||||
assert_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
assert_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
||||||
|
@ -514,7 +514,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_drops_configurations_with_blank_hosts
|
def test_drops_configurations_with_blank_hosts
|
||||||
@configurations[:development].merge!("host" => nil)
|
@configurations[:development]["host"] = nil
|
||||||
|
|
||||||
ActiveRecord::Base.stub(:configurations, @configurations) do
|
ActiveRecord::Base.stub(:configurations, @configurations) do
|
||||||
assert_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
assert_called(ActiveRecord::Tasks::DatabaseTasks, :drop) do
|
||||||
|
|
|
@ -497,9 +497,7 @@ module ActiveSupport
|
||||||
arg.halted || !@user_conditions.all? { |c| c.call(arg.target, arg.value) }
|
arg.halted || !@user_conditions.all? { |c| c.call(arg.target, arg.value) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def nested
|
attr_reader :nested
|
||||||
@nested
|
|
||||||
end
|
|
||||||
|
|
||||||
def final?
|
def final?
|
||||||
!@call_template
|
!@call_template
|
||||||
|
@ -578,7 +576,7 @@ module ActiveSupport
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def chain; @chain; end
|
attr_reader :chain
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -210,9 +210,7 @@ module ActiveSupport
|
||||||
OpenSSL::Cipher.new(@cipher)
|
OpenSSL::Cipher.new(@cipher)
|
||||||
end
|
end
|
||||||
|
|
||||||
def verifier
|
attr_reader :verifier
|
||||||
@verifier
|
|
||||||
end
|
|
||||||
|
|
||||||
def aead_mode?
|
def aead_mode?
|
||||||
@aead_mode ||= new_cipher.authenticated?
|
@aead_mode ||= new_cipher.authenticated?
|
||||||
|
|
|
@ -26,25 +26,21 @@ module ActiveSupport
|
||||||
def pop; @queue.pop; end
|
def pop; @queue.pop; end
|
||||||
end
|
end
|
||||||
|
|
||||||
@after_fork_hooks = []
|
@@after_fork_hooks = []
|
||||||
|
|
||||||
def self.after_fork_hook(&blk)
|
def self.after_fork_hook(&blk)
|
||||||
@after_fork_hooks << blk
|
@@after_fork_hooks << blk
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.after_fork_hooks
|
cattr_reader :after_fork_hooks
|
||||||
@after_fork_hooks
|
|
||||||
end
|
|
||||||
|
|
||||||
@run_cleanup_hooks = []
|
@@run_cleanup_hooks = []
|
||||||
|
|
||||||
def self.run_cleanup_hook(&blk)
|
def self.run_cleanup_hook(&blk)
|
||||||
@run_cleanup_hooks << blk
|
@@run_cleanup_hooks << blk
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.run_cleanup_hooks
|
cattr_reader :run_cleanup_hooks
|
||||||
@run_cleanup_hooks
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize(queue_size)
|
def initialize(queue_size)
|
||||||
@queue_size = queue_size
|
@queue_size = queue_size
|
||||||
|
|
|
@ -265,7 +265,7 @@ module ActiveSupport
|
||||||
private
|
private
|
||||||
def load_country_zones(code)
|
def load_country_zones(code)
|
||||||
country = TZInfo::Country.get(code)
|
country = TZInfo::Country.get(code)
|
||||||
country.zone_identifiers.map do |tz_id|
|
country.zone_identifiers.flat_map do |tz_id|
|
||||||
if MAPPING.value?(tz_id)
|
if MAPPING.value?(tz_id)
|
||||||
MAPPING.inject([]) do |memo, (key, value)|
|
MAPPING.inject([]) do |memo, (key, value)|
|
||||||
memo << self[key] if value == tz_id
|
memo << self[key] if value == tz_id
|
||||||
|
@ -274,7 +274,7 @@ module ActiveSupport
|
||||||
else
|
else
|
||||||
create(tz_id, nil, TZInfo::Timezone.new(tz_id))
|
create(tz_id, nil, TZInfo::Timezone.new(tz_id))
|
||||||
end
|
end
|
||||||
end.flatten(1).sort!
|
end.sort!
|
||||||
end
|
end
|
||||||
|
|
||||||
def zones_map
|
def zones_map
|
||||||
|
|
|
@ -103,9 +103,7 @@ module ActiveSupport::Cache::RedisCacheStoreTests
|
||||||
|
|
||||||
private
|
private
|
||||||
def build(**kwargs)
|
def build(**kwargs)
|
||||||
ActiveSupport::Cache::RedisCacheStore.new(driver: DRIVER, **kwargs).tap do |cache|
|
ActiveSupport::Cache::RedisCacheStore.new(driver: DRIVER, **kwargs).tap(&:redis)
|
||||||
cache.redis
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -373,9 +373,7 @@ module Rails
|
||||||
@config ||= Application::Configuration.new(self.class.find_root(self.class.called_from))
|
@config ||= Application::Configuration.new(self.class.find_root(self.class.called_from))
|
||||||
end
|
end
|
||||||
|
|
||||||
def config=(configuration) #:nodoc:
|
attr_writer :config
|
||||||
@config = configuration
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns secrets added to config/secrets.yml.
|
# Returns secrets added to config/secrets.yml.
|
||||||
#
|
#
|
||||||
|
@ -413,9 +411,7 @@ module Rails
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def secrets=(secrets) #:nodoc:
|
attr_writer :secrets
|
||||||
@secrets = secrets
|
|
||||||
end
|
|
||||||
|
|
||||||
# The secret_key_base is used as the input secret to the application's key generator, which in turn
|
# The secret_key_base is used as the input secret to the application's key generator, which in turn
|
||||||
# is used to create all MessageVerifiers/MessageEncryptors, including the ones that sign and encrypt cookies.
|
# is used to create all MessageVerifiers/MessageEncryptors, including the ones that sign and encrypt cookies.
|
||||||
|
|
|
@ -146,9 +146,7 @@ module Rails
|
||||||
@debug_exception_response_format || :default
|
@debug_exception_response_format || :default
|
||||||
end
|
end
|
||||||
|
|
||||||
def debug_exception_response_format=(value)
|
attr_writer :debug_exception_response_format
|
||||||
@debug_exception_response_format = value
|
|
||||||
end
|
|
||||||
|
|
||||||
def paths
|
def paths
|
||||||
@paths ||= begin
|
@paths ||= begin
|
||||||
|
|
|
@ -79,13 +79,7 @@ module Rails
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def operations
|
attr_reader :operations, :delete_operations
|
||||||
@operations
|
|
||||||
end
|
|
||||||
|
|
||||||
def delete_operations
|
|
||||||
@delete_operations
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Generators #:nodoc:
|
class Generators #:nodoc:
|
||||||
|
|
|
@ -126,7 +126,7 @@ module Rails
|
||||||
)
|
)
|
||||||
|
|
||||||
if ARGV.first == "mailer"
|
if ARGV.first == "mailer"
|
||||||
options[:rails].merge!(template_engine: :erb)
|
options[:rails][:template_engine] = :erb
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,7 @@ module Rails
|
||||||
sudo = options[:sudo] && !Gem.win_platform? ? "sudo " : ""
|
sudo = options[:sudo] && !Gem.win_platform? ? "sudo " : ""
|
||||||
config = { verbose: false }
|
config = { verbose: false }
|
||||||
|
|
||||||
config.merge!(capture: options[:capture]) if options[:capture]
|
config[:capture] = options[:capture] if options[:capture]
|
||||||
|
|
||||||
in_root { run("#{sudo}#{extify(executor)} #{command} RAILS_ENV=#{env}", config) }
|
in_root { run("#{sudo}#{extify(executor)} #{command} RAILS_ENV=#{env}", config) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,12 +9,12 @@ class AppLoaderTest < ActiveSupport::TestCase
|
||||||
@loader ||= Class.new do
|
@loader ||= Class.new do
|
||||||
extend Rails::AppLoader
|
extend Rails::AppLoader
|
||||||
|
|
||||||
def self.exec_arguments
|
class << self
|
||||||
@exec_arguments
|
attr_accessor :exec_arguments
|
||||||
end
|
|
||||||
|
|
||||||
def self.exec(*args)
|
def exec(*args)
|
||||||
@exec_arguments = args
|
self.exec_arguments = args
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -151,7 +151,8 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
def build_app(console)
|
def build_app(console)
|
||||||
mocked_console = Class.new do
|
mocked_console = Class.new do
|
||||||
attr_reader :sandbox, :console
|
attr_accessor :sandbox
|
||||||
|
attr_reader :console
|
||||||
|
|
||||||
def initialize(console)
|
def initialize(console)
|
||||||
@console = console
|
@console = console
|
||||||
|
@ -161,10 +162,6 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def sandbox=(arg)
|
|
||||||
@sandbox = arg
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_console
|
def load_console
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue