Reduce Cyclomatic Complexity

This commit is contained in:
Neal Chambers
2023-09-25 18:08:30 +09:00
parent 099b2f455f
commit d4c363ac39

View File

@@ -39,13 +39,7 @@ RSpec.describe "Database" do
end
end
if migrations
puts "Foreign key(s) appear to be absent from the database. " \
"You can add it/them using the following migration(s):"
puts migrations.join("\n")
puts "\nTo disable this warning, add the class name(s) of the model(s) to models_todo " \
"in #{__FILE__}"
end
print_missing_foreign_key_warnings(migrations)
puts "The following models are marked as todo in #{__FILE__}:"
puts pending_models.join(", ")
@@ -53,6 +47,16 @@ RSpec.describe "Database" do
migrations
end
def print_missing_foreign_key_warnings(migrations)
return if migrations.empty?
puts "Foreign key(s) appear to be absent from the database. " \
"You can add it/them using the following migration(s):"
puts migrations.join("\n")
puts "\nTo disable this warning, add the class name(s) of the model(s) to models_todo " \
"in #{__FILE__}"
end
def process_association(model_class, association, previous_models)
return if association.options[:polymorphic]