Aller au contenu

Long Function (ARCH8180)

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

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

Flags functions longer than 50 lines, or @Composable functions longer than 150 - a composable is a declarative UI tree, and its length measures how much UI it declares.

fun process(order: Order) {
// 80 lines of validation, pricing, persistence and notification
}
fun process(order: Order) {
validate(order)
val priced = price(order)
persist(priced)
notify(priced)
}

Extract cohesive steps into named functions.