Aller au contenu

Long Function (ARCH9180)

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

Key swift.quality.long-method · Severity info · Category quality

Flags functions longer than 50 lines.

func process(_ order: Order) {
// 80 lines of validation, pricing, persistence and notification
}
func process(_ order: Order) throws {
try validate(order)
let priced = price(order)
try persist(priced)
notify(priced)
}

Extract cohesive steps into named functions.