Zum Inhalt springen

Long Function (ARCH8180)

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

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.