mirror of https://github.com/rails/rails
Autocorrect Rubocop roles
This commit is contained in:
parent
9dbacf4d71
commit
94b954576a
|
@ -221,9 +221,6 @@ GEM
|
|||
tzinfo
|
||||
event_emitter (0.2.6)
|
||||
eventmachine (1.2.7)
|
||||
eventmachine (1.2.7-java)
|
||||
eventmachine (1.2.7-x64-mingw32)
|
||||
eventmachine (1.2.7-x86-mingw32)
|
||||
execjs (2.7.0)
|
||||
faraday (1.3.0)
|
||||
faraday-net_http (~> 1.0)
|
||||
|
@ -291,14 +288,12 @@ GEM
|
|||
hiredis (0.6.3)
|
||||
hiredis (0.6.3-java)
|
||||
http_parser.rb (0.6.0)
|
||||
http_parser.rb (0.6.0-java)
|
||||
httpclient (2.8.3)
|
||||
i18n (1.8.10)
|
||||
concurrent-ruby (~> 1.0)
|
||||
image_processing (1.12.1)
|
||||
mini_magick (>= 4.9.5, < 5)
|
||||
ruby-vips (>= 2.0.17, < 3)
|
||||
jar-dependencies (0.4.1)
|
||||
jdbc-mysql (5.1.47)
|
||||
jdbc-postgres (42.2.14)
|
||||
jdbc-sqlite3 (3.28.0)
|
||||
|
@ -310,7 +305,6 @@ GEM
|
|||
mustache
|
||||
nokogiri
|
||||
libxml-ruby (3.2.1)
|
||||
libxml-ruby (3.2.1-x64-mingw32)
|
||||
listen (3.5.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
|
@ -368,8 +362,6 @@ GEM
|
|||
path_expander (1.1.0)
|
||||
pg (1.2.3)
|
||||
psych (3.3.1)
|
||||
psych (3.3.1-java)
|
||||
jar-dependencies (>= 0.1.7)
|
||||
public_suffix (4.0.6)
|
||||
puma (5.2.2)
|
||||
nio4r (~> 2.0)
|
||||
|
|
|
@ -22,12 +22,10 @@ module AbstractController
|
|||
end
|
||||
|
||||
def action_methods
|
||||
@action_methods ||= begin
|
||||
if _routes
|
||||
super - _routes.named_routes.helper_names
|
||||
else
|
||||
super
|
||||
end
|
||||
@action_methods ||= if _routes
|
||||
super - _routes.named_routes.helper_names
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -258,12 +258,10 @@ module ActionDispatch
|
|||
# req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080'
|
||||
# req.port # => 8080
|
||||
def port
|
||||
@port ||= begin
|
||||
if raw_host_with_port =~ /:(\d+)$/
|
||||
$1.to_i
|
||||
else
|
||||
standard_port
|
||||
end
|
||||
@port ||= if raw_host_with_port =~ /:(\d+)$/
|
||||
$1.to_i
|
||||
else
|
||||
standard_port
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -223,9 +223,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def reflection_scope
|
||||
@reflection_scope ||= begin
|
||||
reflection.join_scopes(klass.arel_table, klass.predicate_builder, klass).inject(&:merge!) || klass.unscoped
|
||||
end
|
||||
@reflection_scope ||= reflection.join_scopes(klass.arel_table, klass.predicate_builder, klass).inject(&:merge!) || klass.unscoped
|
||||
end
|
||||
|
||||
def build_scope
|
||||
|
|
|
@ -119,9 +119,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def clean_text_scheme
|
||||
@clean_text_scheme ||= begin
|
||||
ActiveRecord::Encryption::Scheme.new(downcase: downcase?, encryptor: ActiveRecord::Encryption::NullEncryptor.new)
|
||||
end
|
||||
@clean_text_scheme ||= ActiveRecord::Encryption::Scheme.new(downcase: downcase?, encryptor: ActiveRecord::Encryption::NullEncryptor.new)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -260,19 +260,17 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def set_base_class # :nodoc:
|
||||
@base_class = begin
|
||||
if self == Base
|
||||
@base_class = if self == Base
|
||||
self
|
||||
else
|
||||
unless self < Base
|
||||
raise ActiveRecordError, "#{name} doesn't belong in a hierarchy descending from ActiveRecord"
|
||||
end
|
||||
|
||||
if superclass == Base || superclass.abstract_class?
|
||||
self
|
||||
else
|
||||
unless self < Base
|
||||
raise ActiveRecordError, "#{name} doesn't belong in a hierarchy descending from ActiveRecord"
|
||||
end
|
||||
|
||||
if superclass == Base || superclass.abstract_class?
|
||||
self
|
||||
else
|
||||
superclass.base_class
|
||||
end
|
||||
superclass.base_class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -698,16 +698,14 @@ module ActiveRecord
|
|||
# User.where(name: 'Oscar').to_sql
|
||||
# # => SELECT "users".* FROM "users" WHERE "users"."name" = 'Oscar'
|
||||
def to_sql
|
||||
@to_sql ||= begin
|
||||
if eager_loading?
|
||||
apply_join_dependency do |relation, join_dependency|
|
||||
relation = join_dependency.apply_column_aliases(relation)
|
||||
relation.to_sql
|
||||
end
|
||||
else
|
||||
conn = klass.connection
|
||||
conn.unprepared_statement { conn.to_sql(arel) }
|
||||
@to_sql ||= if eager_loading?
|
||||
apply_join_dependency do |relation, join_dependency|
|
||||
relation = join_dependency.apply_column_aliases(relation)
|
||||
relation.to_sql
|
||||
end
|
||||
else
|
||||
conn = klass.connection
|
||||
conn.unprepared_statement { conn.to_sql(arel) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -63,15 +63,11 @@ Product = Struct.new(:name) do
|
|||
delegate :name, to: :type, prefix: true
|
||||
|
||||
def manufacturer
|
||||
@manufacturer ||= begin
|
||||
nil.unknown_method
|
||||
end
|
||||
@manufacturer ||= nil.unknown_method
|
||||
end
|
||||
|
||||
def type
|
||||
@type ||= begin
|
||||
nil.type_name
|
||||
end
|
||||
@type ||= nil.type_name
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -259,8 +259,7 @@ module Rails
|
|||
# Stores some of the Rails initial environment parameters which
|
||||
# will be used by middlewares and engines to configure themselves.
|
||||
def env_config
|
||||
@app_env_config ||= begin
|
||||
super.merge(
|
||||
@app_env_config ||= super.merge(
|
||||
"action_dispatch.parameter_filter" => config.filter_parameters,
|
||||
"action_dispatch.redirect_filter" => config.filter_redirect,
|
||||
"action_dispatch.secret_key_base" => secret_key_base,
|
||||
|
@ -288,7 +287,6 @@ module Rails
|
|||
"action_dispatch.content_security_policy_nonce_directives" => config.content_security_policy_nonce_directives,
|
||||
"action_dispatch.permissions_policy" => config.permissions_policy,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
# If you try to define a set of Rake tasks on the instance, these will get
|
||||
|
|
|
@ -86,10 +86,8 @@ module Rails
|
|||
#
|
||||
# Rails::Command::TestCommand.base_name # => 'rails'
|
||||
def base_name
|
||||
@base_name ||= begin
|
||||
if base = name.to_s.split("::").first
|
||||
base.underscore
|
||||
end
|
||||
@base_name ||= if base = name.to_s.split("::").first
|
||||
base.underscore
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -97,11 +95,9 @@ module Rails
|
|||
#
|
||||
# Rails::Command::TestCommand.command_name # => 'test'
|
||||
def command_name
|
||||
@command_name ||= begin
|
||||
if command = name.to_s.split("::").last
|
||||
command.chomp!("Command")
|
||||
command.underscore
|
||||
end
|
||||
@command_name ||= if command = name.to_s.split("::").last
|
||||
command.chomp!("Command")
|
||||
command.underscore
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -39,10 +39,8 @@ module Rails
|
|||
end
|
||||
|
||||
def existing_migration
|
||||
@existing_migration ||= begin
|
||||
@base.class.migration_exists?(migration_dir, migration_file_name) ||
|
||||
@existing_migration ||= @base.class.migration_exists?(migration_dir, migration_file_name) ||
|
||||
File.exist?(@destination) && @destination
|
||||
end
|
||||
end
|
||||
alias :exists? :existing_migration
|
||||
|
||||
|
|
|
@ -324,21 +324,17 @@ module Rails
|
|||
|
||||
# Sets the base_name taking into account the current class namespace.
|
||||
def self.base_name # :doc:
|
||||
@base_name ||= begin
|
||||
if base = name.to_s.split("::").first
|
||||
base.underscore
|
||||
end
|
||||
@base_name ||= if base = name.to_s.split("::").first
|
||||
base.underscore
|
||||
end
|
||||
end
|
||||
|
||||
# Removes the namespaces and get the generator name. For example,
|
||||
# Rails::Generators::ModelGenerator will return "model" as generator name.
|
||||
def self.generator_name # :doc:
|
||||
@generator_name ||= begin
|
||||
if generator = name.to_s.split("::").last
|
||||
generator.delete_suffix!("Generator")
|
||||
generator.underscore
|
||||
end
|
||||
@generator_name ||= if generator = name.to_s.split("::").last
|
||||
generator.delete_suffix!("Generator")
|
||||
generator.underscore
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue