Aller au contenu

Named Boolean Parameter (ARCH6185)

Ce contenu n’est pas encore disponible dans votre langue.

Key ruby.quality.named-boolean-parameter · Severity info · Category quality

Bare true/false passed positionally is meaningless at the call site; the reader cannot tell what the flag does without opening the method definition.

def create_account(name, active, verified)
end
create_account("Murat", true, false)
def create_account(name, active:, verified:)
end
create_account("Murat", active: true, verified: false)

Turn boolean arguments into descriptive keyword arguments so the call site is self-documenting.