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,8 +22,7 @@ module AbstractController
|
|||
end
|
||||
|
||||
def action_methods
|
||||
@action_methods ||= begin
|
||||
if _routes
|
||||
@action_methods ||= if _routes
|
||||
super - _routes.named_routes.helper_names
|
||||
else
|
||||
super
|
||||
|
@ -32,4 +31,3 @@ module AbstractController
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -258,14 +258,12 @@ module ActionDispatch
|
|||
# req = ActionDispatch::Request.new 'HTTP_HOST' => 'example.com:8080'
|
||||
# req.port # => 8080
|
||||
def port
|
||||
@port ||= begin
|
||||
if raw_host_with_port =~ /:(\d+)$/
|
||||
@port ||= if raw_host_with_port =~ /:(\d+)$/
|
||||
$1.to_i
|
||||
else
|
||||
standard_port
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the standard \port number for this request's protocol.
|
||||
#
|
||||
|
|
|
@ -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,8 +260,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def set_base_class # :nodoc:
|
||||
@base_class = begin
|
||||
if self == Base
|
||||
@base_class = if self == Base
|
||||
self
|
||||
else
|
||||
unless self < Base
|
||||
|
@ -275,7 +274,6 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Called by +instantiate+ to decide which class to use for a new
|
||||
|
|
|
@ -698,8 +698,7 @@ 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?
|
||||
@to_sql ||= if eager_loading?
|
||||
apply_join_dependency do |relation, join_dependency|
|
||||
relation = join_dependency.apply_column_aliases(relation)
|
||||
relation.to_sql
|
||||
|
@ -709,7 +708,6 @@ module ActiveRecord
|
|||
conn.unprepared_statement { conn.to_sql(arel) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Returns a hash of where conditions.
|
||||
#
|
||||
|
|
|
@ -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,
|
||||
|
@ -289,7 +288,6 @@ module Rails
|
|||
"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
|
||||
# passed up to the Rake tasks defined on the application's class.
|
||||
|
|
|
@ -86,24 +86,20 @@ module Rails
|
|||
#
|
||||
# Rails::Command::TestCommand.base_name # => 'rails'
|
||||
def base_name
|
||||
@base_name ||= begin
|
||||
if base = name.to_s.split("::").first
|
||||
@base_name ||= if base = name.to_s.split("::").first
|
||||
base.underscore
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Return command name without namespaces.
|
||||
#
|
||||
# Rails::Command::TestCommand.command_name # => 'test'
|
||||
def command_name
|
||||
@command_name ||= begin
|
||||
if command = name.to_s.split("::").last
|
||||
@command_name ||= if command = name.to_s.split("::").last
|
||||
command.chomp!("Command")
|
||||
command.underscore
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Path to lookup a USAGE description in a file.
|
||||
def usage_path
|
||||
|
|
|
@ -39,11 +39,9 @@ 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
|
||||
|
||||
private
|
||||
|
|
|
@ -324,23 +324,19 @@ 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_name ||= if base = name.to_s.split("::").first
|
||||
base.underscore
|
||||
end
|
||||
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_name ||= if generator = name.to_s.split("::").last
|
||||
generator.delete_suffix!("Generator")
|
||||
generator.underscore
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the default value for the option name given doing a lookup in
|
||||
# Rails::Generators.options.
|
||||
|
|
Loading…
Reference in New Issue