Skip to content

multiline-expression-wrapping

Kotlinstyleno fixdefault: offkotlin/ktlint

Reports an expression that spans lines and starts after code on its line: the value of a property or a function body after =, or an argument.

An expression that begins after val a = and goes on over several lines has its first line far from the left edge and the rest below, so the shape of the block is hard to read. A new line before it gives it a place of its own.

To fix, start the expression on the next line.

Reported
...
fun baz() = run {
1
}
val x = listOf(
1,
...
)
...
kotlin:
lint:
rules:
multiline-expression-wrapping: warn # off (default), warn, error

Enabled by the presets: kotlin/ktlint.

Suppress one line with sudsy-disable-next-line multiline-expression-wrapping in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ktlint multiline-expression-wrapping full