Skip to content

blank-line-between-when-conditions

Kotlinstyleno fixdefault: offkotlin/ktlint

Reports a when entry with a blank line before it that the formatter would add or remove.

Blank lines between the entries of a when are laid out by one rule, so the spacing does not depend on the author and is not changed by hand.

To fix, run the formatter.

Reported
...
else -> println(2)
}
foo(); bar()
...
kotlin:
lint:
rules:
blank-line-between-when-conditions: warn # off (default), warn, error

Enabled by the presets: kotlin/ktlint.

Suppress one line with sudsy-disable-next-line blank-line-between-when-conditions 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 blank-line-between-when-conditions full