Zum Inhalt springen

Named Boolean Parameter (ARCH6185)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

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.