parent
c4b944a273
commit
bbbc861f71
|
@ -253,6 +253,9 @@ Performance/BindCall:
|
||||||
Performance/FlatMap:
|
Performance/FlatMap:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Performance/MapCompact:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Performance/RedundantMerge:
|
Performance/RedundantMerge:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|
16
Gemfile.lock
16
Gemfile.lock
|
@ -221,6 +221,9 @@ GEM
|
||||||
tzinfo
|
tzinfo
|
||||||
event_emitter (0.2.6)
|
event_emitter (0.2.6)
|
||||||
eventmachine (1.2.7)
|
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)
|
execjs (2.7.0)
|
||||||
faraday (1.3.0)
|
faraday (1.3.0)
|
||||||
faraday-net_http (~> 1.0)
|
faraday-net_http (~> 1.0)
|
||||||
|
@ -288,12 +291,14 @@ GEM
|
||||||
hiredis (0.6.3)
|
hiredis (0.6.3)
|
||||||
hiredis (0.6.3-java)
|
hiredis (0.6.3-java)
|
||||||
http_parser.rb (0.6.0)
|
http_parser.rb (0.6.0)
|
||||||
|
http_parser.rb (0.6.0-java)
|
||||||
httpclient (2.8.3)
|
httpclient (2.8.3)
|
||||||
i18n (1.8.10)
|
i18n (1.8.10)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
image_processing (1.12.1)
|
image_processing (1.12.1)
|
||||||
mini_magick (>= 4.9.5, < 5)
|
mini_magick (>= 4.9.5, < 5)
|
||||||
ruby-vips (>= 2.0.17, < 3)
|
ruby-vips (>= 2.0.17, < 3)
|
||||||
|
jar-dependencies (0.4.1)
|
||||||
jdbc-mysql (5.1.47)
|
jdbc-mysql (5.1.47)
|
||||||
jdbc-postgres (42.2.14)
|
jdbc-postgres (42.2.14)
|
||||||
jdbc-sqlite3 (3.28.0)
|
jdbc-sqlite3 (3.28.0)
|
||||||
|
@ -305,6 +310,7 @@ GEM
|
||||||
mustache
|
mustache
|
||||||
nokogiri
|
nokogiri
|
||||||
libxml-ruby (3.2.1)
|
libxml-ruby (3.2.1)
|
||||||
|
libxml-ruby (3.2.1-x64-mingw32)
|
||||||
listen (3.5.1)
|
listen (3.5.1)
|
||||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
rb-inotify (~> 0.9, >= 0.9.10)
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
|
@ -361,7 +367,11 @@ GEM
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
path_expander (1.1.0)
|
path_expander (1.1.0)
|
||||||
pg (1.2.3)
|
pg (1.2.3)
|
||||||
|
pg (1.2.3-x64-mingw32)
|
||||||
|
pg (1.2.3-x86-mingw32)
|
||||||
psych (3.3.1)
|
psych (3.3.1)
|
||||||
|
psych (3.3.1-java)
|
||||||
|
jar-dependencies (>= 0.1.7)
|
||||||
public_suffix (4.0.6)
|
public_suffix (4.0.6)
|
||||||
puma (5.2.2)
|
puma (5.2.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
|
@ -417,7 +427,7 @@ GEM
|
||||||
retriable (3.1.2)
|
retriable (3.1.2)
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
rouge (3.26.0)
|
rouge (3.26.0)
|
||||||
rubocop (1.12.1)
|
rubocop (1.13.0)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 3.0.0.0)
|
parser (>= 3.0.0.0)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
@ -430,8 +440,8 @@ GEM
|
||||||
parser (>= 2.7.1.5)
|
parser (>= 2.7.1.5)
|
||||||
rubocop-packaging (0.5.1)
|
rubocop-packaging (0.5.1)
|
||||||
rubocop (>= 0.89, < 2.0)
|
rubocop (>= 0.89, < 2.0)
|
||||||
rubocop-performance (1.10.2)
|
rubocop-performance (1.11.0)
|
||||||
rubocop (>= 0.90.0, < 2.0)
|
rubocop (>= 1.7.0, < 2.0)
|
||||||
rubocop-ast (>= 0.4.0)
|
rubocop-ast (>= 0.4.0)
|
||||||
rubocop-rails (2.9.1)
|
rubocop-rails (2.9.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
|
|
|
@ -130,7 +130,7 @@ module ActionDispatch
|
||||||
states = "function tt() { return #{to_json}; }"
|
states = "function tt() { return #{to_json}; }"
|
||||||
|
|
||||||
fun_routes = paths.sample(3).map do |ast|
|
fun_routes = paths.sample(3).map do |ast|
|
||||||
ast.map { |n|
|
ast.filter_map { |n|
|
||||||
case n
|
case n
|
||||||
when Nodes::Symbol
|
when Nodes::Symbol
|
||||||
case n.left
|
case n.left
|
||||||
|
@ -143,7 +143,7 @@ module ActionDispatch
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
}.compact.join
|
}.join
|
||||||
end
|
end
|
||||||
|
|
||||||
stylesheets = [fsm_css]
|
stylesheets = [fsm_css]
|
||||||
|
|
|
@ -31,7 +31,7 @@ module ActionText
|
||||||
|
|
||||||
def encryptable_rich_texts
|
def encryptable_rich_texts
|
||||||
@encryptable_rich_texts ||= self.class.rich_text_association_names
|
@encryptable_rich_texts ||= self.class.rich_text_association_names
|
||||||
.collect { |attribute_name| send(attribute_name) }.compact
|
.filter_map { |attribute_name| send(attribute_name) }
|
||||||
.find_all { |record| record.is_a?(ActionText::EncryptedRichText) }
|
.find_all { |record| record.is_a?(ActionText::EncryptedRichText) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -793,9 +793,9 @@ module ActionView
|
||||||
|
|
||||||
def extract_values_from_collection(collection, value_method, selected)
|
def extract_values_from_collection(collection, value_method, selected)
|
||||||
if selected.is_a?(Proc)
|
if selected.is_a?(Proc)
|
||||||
collection.map do |element|
|
collection.filter_map do |element|
|
||||||
element.public_send(value_method) if selected.call(element)
|
element.public_send(value_method) if selected.call(element)
|
||||||
end.compact
|
end
|
||||||
else
|
else
|
||||||
selected
|
selected
|
||||||
end
|
end
|
||||||
|
|
|
@ -399,7 +399,7 @@ module ActiveModel
|
||||||
|
|
||||||
def attribute_method_matchers_matching(method_name)
|
def attribute_method_matchers_matching(method_name)
|
||||||
attribute_method_matchers_cache.compute_if_absent(method_name) do
|
attribute_method_matchers_cache.compute_if_absent(method_name) do
|
||||||
attribute_method_matchers.map { |matcher| matcher.match(method_name) }.compact
|
attribute_method_matchers.filter_map { |matcher| matcher.match(method_name) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,13 @@ module ActiveModel
|
||||||
|
|
||||||
private
|
private
|
||||||
def setup!(klass)
|
def setup!(klass)
|
||||||
klass.attr_reader(*attributes.map do |attribute|
|
klass.attr_reader(*attributes.filter_map do |attribute|
|
||||||
:"#{attribute}_confirmation" unless klass.method_defined?(:"#{attribute}_confirmation")
|
:"#{attribute}_confirmation" unless klass.method_defined?(:"#{attribute}_confirmation")
|
||||||
end.compact)
|
end)
|
||||||
|
|
||||||
klass.attr_writer(*attributes.map do |attribute|
|
klass.attr_writer(*attributes.filter_map do |attribute|
|
||||||
:"#{attribute}_confirmation" unless klass.method_defined?(:"#{attribute}_confirmation=")
|
:"#{attribute}_confirmation" unless klass.method_defined?(:"#{attribute}_confirmation=")
|
||||||
end.compact)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirmation_value_equal?(record, attribute, value, confirmed)
|
def confirmation_value_equal?(record, attribute, value, confirmed)
|
||||||
|
|
|
@ -46,9 +46,9 @@ module ActiveRecord
|
||||||
|
|
||||||
def likely_reflections
|
def likely_reflections
|
||||||
parent_classes = parent.target_classes
|
parent_classes = parent.target_classes
|
||||||
parent_classes.map do |parent_klass|
|
parent_classes.filter_map do |parent_klass|
|
||||||
parent_klass._reflect_on_association(@association)
|
parent_klass._reflect_on_association(@association)
|
||||||
end.compact
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def root?
|
def root?
|
||||||
|
|
|
@ -498,10 +498,10 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_fixture_statements(fixture_set)
|
def build_fixture_statements(fixture_set)
|
||||||
fixture_set.map do |table_name, fixtures|
|
fixture_set.filter_map do |table_name, fixtures|
|
||||||
next if fixtures.empty?
|
next if fixtures.empty?
|
||||||
build_fixture_sql(fixtures, table_name)
|
build_fixture_sql(fixtures, table_name)
|
||||||
end.compact
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_truncate_statement(table_name)
|
def build_truncate_statement(table_name)
|
||||||
|
|
|
@ -787,14 +787,13 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
# Gather up all of the SET variables...
|
# Gather up all of the SET variables...
|
||||||
variable_assignments = variables.map do |k, v|
|
variable_assignments = variables.filter_map do |k, v|
|
||||||
if defaults.include?(v)
|
if defaults.include?(v)
|
||||||
"@@SESSION.#{k} = DEFAULT" # Sets the value to the global or compile default
|
"@@SESSION.#{k} = DEFAULT" # Sets the value to the global or compile default
|
||||||
elsif !v.nil?
|
elsif !v.nil?
|
||||||
"@@SESSION.#{k} = #{quote(v)}"
|
"@@SESSION.#{k} = #{quote(v)}"
|
||||||
end
|
end
|
||||||
# or else nil; compact to clear nils out
|
end.join(", ")
|
||||||
end.compact.join(", ")
|
|
||||||
|
|
||||||
# ...and send them all in one query
|
# ...and send them all in one query
|
||||||
execute("SET #{encoding} #{sql_mode_assignment} #{variable_assignments}", "SCHEMA")
|
execute("SET #{encoding} #{sql_mode_assignment} #{variable_assignments}", "SCHEMA")
|
||||||
|
|
|
@ -917,9 +917,7 @@ module ActiveRecord
|
||||||
WHERE t.typname IN (%s)
|
WHERE t.typname IN (%s)
|
||||||
SQL
|
SQL
|
||||||
coders = execute_and_clear(query, "SCHEMA", []) do |result|
|
coders = execute_and_clear(query, "SCHEMA", []) do |result|
|
||||||
result
|
result.filter_map { |row| construct_coder(row, coders_by_name[row["typname"]]) }
|
||||||
.map { |row| construct_coder(row, coders_by_name[row["typname"]]) }
|
|
||||||
.compact
|
|
||||||
end
|
end
|
||||||
|
|
||||||
map = PG::TypeMapByOid.new
|
map = PG::TypeMapByOid.new
|
||||||
|
|
|
@ -6,7 +6,7 @@ module ActiveRecord
|
||||||
module SchemaStatements # :nodoc:
|
module SchemaStatements # :nodoc:
|
||||||
# Returns an array of indexes for the given table.
|
# Returns an array of indexes for the given table.
|
||||||
def indexes(table_name)
|
def indexes(table_name)
|
||||||
exec_query("PRAGMA index_list(#{quote_table_name(table_name)})", "SCHEMA").map do |row|
|
exec_query("PRAGMA index_list(#{quote_table_name(table_name)})", "SCHEMA").filter_map do |row|
|
||||||
# Indexes SQLite creates implicitly for internal use start with "sqlite_".
|
# Indexes SQLite creates implicitly for internal use start with "sqlite_".
|
||||||
# See https://www.sqlite.org/fileformat2.html#intschema
|
# See https://www.sqlite.org/fileformat2.html#intschema
|
||||||
next if row["name"].start_with?("sqlite_")
|
next if row["name"].start_with?("sqlite_")
|
||||||
|
@ -49,7 +49,7 @@ module ActiveRecord
|
||||||
where: where,
|
where: where,
|
||||||
orders: orders
|
orders: orders
|
||||||
)
|
)
|
||||||
end.compact
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_foreign_key(from_table, to_table, **options)
|
def add_foreign_key(from_table, to_table, **options)
|
||||||
|
|
|
@ -796,11 +796,11 @@ module ActiveRecord
|
||||||
# We check defined?(@attributes) not to issue warnings if the object is
|
# We check defined?(@attributes) not to issue warnings if the object is
|
||||||
# allocated but not initialized.
|
# allocated but not initialized.
|
||||||
inspection = if defined?(@attributes) && @attributes
|
inspection = if defined?(@attributes) && @attributes
|
||||||
self.class.attribute_names.collect do |name|
|
self.class.attribute_names.filter_map do |name|
|
||||||
if _has_attribute?(name)
|
if _has_attribute?(name)
|
||||||
"#{name}: #{attribute_for_inspect(name)}"
|
"#{name}: #{attribute_for_inspect(name)}"
|
||||||
end
|
end
|
||||||
end.compact.join(", ")
|
end.join(", ")
|
||||||
else
|
else
|
||||||
"not initialized"
|
"not initialized"
|
||||||
end
|
end
|
||||||
|
|
|
@ -196,11 +196,11 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def touch_model_timestamps_unless(&block)
|
def touch_model_timestamps_unless(&block)
|
||||||
model.timestamp_attributes_for_update_in_model.map do |column_name|
|
model.timestamp_attributes_for_update_in_model.filter_map do |column_name|
|
||||||
if touch_timestamp_attribute?(column_name)
|
if touch_timestamp_attribute?(column_name)
|
||||||
"#{column_name}=(CASE WHEN (#{updatable_columns.map(&block).join(" AND ")}) THEN #{model.quoted_table_name}.#{column_name} ELSE CURRENT_TIMESTAMP END),"
|
"#{column_name}=(CASE WHEN (#{updatable_columns.map(&block).join(" AND ")}) THEN #{model.quoted_table_name}.#{column_name} ELSE CURRENT_TIMESTAMP END),"
|
||||||
end
|
end
|
||||||
end.compact.join
|
end.join
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw_update_sql
|
def raw_update_sql
|
||||||
|
|
|
@ -1159,13 +1159,13 @@ module ActiveRecord
|
||||||
def migrations_status # :nodoc:
|
def migrations_status # :nodoc:
|
||||||
db_list = schema_migration.normalized_versions
|
db_list = schema_migration.normalized_versions
|
||||||
|
|
||||||
file_list = migration_files.map do |file|
|
file_list = migration_files.filter_map do |file|
|
||||||
version, name, scope = parse_migration_filename(file)
|
version, name, scope = parse_migration_filename(file)
|
||||||
raise IllegalMigrationNameError.new(file) unless version
|
raise IllegalMigrationNameError.new(file) unless version
|
||||||
version = schema_migration.normalize_migration_number(version)
|
version = schema_migration.normalize_migration_number(version)
|
||||||
status = db_list.delete(version) ? "up" : "down"
|
status = db_list.delete(version) ? "up" : "down"
|
||||||
[status, version, (name + scope).humanize]
|
[status, version, (name + scope).humanize]
|
||||||
end.compact
|
end
|
||||||
|
|
||||||
db_list.map! do |version|
|
db_list.map! do |version|
|
||||||
["up", version, "********** NO FILE **********"]
|
["up", version, "********** NO FILE **********"]
|
||||||
|
|
|
@ -94,7 +94,7 @@ module ActiveRecord
|
||||||
sslcapath: "--ssl-capath",
|
sslcapath: "--ssl-capath",
|
||||||
sslcipher: "--ssl-cipher",
|
sslcipher: "--ssl-cipher",
|
||||||
sslkey: "--ssl-key"
|
sslkey: "--ssl-key"
|
||||||
}.map { |opt, arg| "#{arg}=#{configuration_hash[opt]}" if configuration_hash[opt] }.compact
|
}.filter_map { |opt, arg| "#{arg}=#{configuration_hash[opt]}" if configuration_hash[opt] }
|
||||||
|
|
||||||
args
|
args
|
||||||
end
|
end
|
||||||
|
|
|
@ -148,8 +148,7 @@ module ActiveRecord
|
||||||
|
|
||||||
def max_updated_column_timestamp
|
def max_updated_column_timestamp
|
||||||
timestamp_attributes_for_update_in_model
|
timestamp_attributes_for_update_in_model
|
||||||
.map { |attr| self[attr]&.to_time }
|
.filter_map { |attr| self[attr]&.to_time }
|
||||||
.compact
|
|
||||||
.max
|
.max
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -75,11 +75,11 @@ class Hash
|
||||||
#
|
#
|
||||||
# This method is also aliased as +to_param+.
|
# This method is also aliased as +to_param+.
|
||||||
def to_query(namespace = nil)
|
def to_query(namespace = nil)
|
||||||
query = collect do |key, value|
|
query = filter_map do |key, value|
|
||||||
unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty?
|
unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty?
|
||||||
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
|
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
|
||||||
end
|
end
|
||||||
end.compact
|
end
|
||||||
|
|
||||||
query.sort! unless namespace.to_s.include?("[]")
|
query.sort! unless namespace.to_s.include?("[]")
|
||||||
query.join("&")
|
query.join("&")
|
||||||
|
|
|
@ -45,13 +45,13 @@ module TestUnit # :nodoc:
|
||||||
def attributes_hash
|
def attributes_hash
|
||||||
return {} if attributes_names.empty?
|
return {} if attributes_names.empty?
|
||||||
|
|
||||||
attributes_names.map do |name|
|
attributes_names.filter_map do |name|
|
||||||
if %w(password password_confirmation).include?(name) && attributes.any?(&:password_digest?)
|
if %w(password password_confirmation).include?(name) && attributes.any?(&:password_digest?)
|
||||||
["#{name}", "'secret'"]
|
["#{name}", "'secret'"]
|
||||||
elsif !virtual?(name)
|
elsif !virtual?(name)
|
||||||
["#{name}", "@#{singular_table_name}.#{name}"]
|
["#{name}", "@#{singular_table_name}.#{name}"]
|
||||||
end
|
end
|
||||||
end.compact.sort.to_h
|
end.sort.to_h
|
||||||
end
|
end
|
||||||
|
|
||||||
def boolean?(name)
|
def boolean?(name)
|
||||||
|
|
|
@ -54,11 +54,11 @@ namespace :zeitwerk do
|
||||||
end
|
end
|
||||||
|
|
||||||
require "active_support/core_ext/object/try"
|
require "active_support/core_ext/object/try"
|
||||||
eager_load_paths = Rails.configuration.eager_load_namespaces.map do |eln|
|
eager_load_paths = Rails.configuration.eager_load_namespaces.filter_map do |eln|
|
||||||
# Quick regression fix for 6.0.3 to support namespaces that do not have
|
# Quick regression fix for 6.0.3 to support namespaces that do not have
|
||||||
# eager load paths, like the recently added i18n. I'll rewrite this task.
|
# eager load paths, like the recently added i18n. I'll rewrite this task.
|
||||||
eln.try(:config).try(:eager_load_paths)
|
eln.try(:config).try(:eager_load_paths)
|
||||||
end.compact.flatten
|
end.flatten
|
||||||
|
|
||||||
not_checked = ActiveSupport::Dependencies.autoload_paths - eager_load_paths
|
not_checked = ActiveSupport::Dependencies.autoload_paths - eager_load_paths
|
||||||
not_checked.select! { |dir| Dir.exist?(dir) }
|
not_checked.select! { |dir| Dir.exist?(dir) }
|
||||||
|
|
Loading…
Reference in New Issue