تخطَّ إلى المحتوى

Too Many Parameters (ARCH6181)

هذا المحتوى غير متوفر بلغتك بعد.

Key ruby.quality.too-many-parameters · Severity warning · Category quality

A method that takes too many parameters is confusing at call sites and usually hides a concept that should be encapsulated in a parameter object.

def create_user(name, email, age, country, city, phone, role)
User.new(name, email, age, country, city, phone, role)
end
def create_user(profile)
User.new(profile)
end
profile = UserProfile.new(name:, email:, age:, country:, city:, phone:, role:)
create_user(profile)

Group related parameters into a parameter object or a struct of keyword arguments.