pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.07k stars 504 forks source link

Add rule `blank-line-between-when-conditions` #2564

Closed paul-dingemans closed 4 months ago

paul-dingemans commented 4 months ago

Description

Add rule blank-line-between-when-conditions.

Depending on .editorconfig property ij_kotlin_line_break_after_multiline_when_entry blank lines are added between all when-entries in a when-statement if the statement contains at least one multiline when-entry.

Simple when-statements (e.g. all when-entries are single line) then blank lines between the when-entries are removed (regardless of ij_kotlin_line_break_after_multiline_when_entry)

Closes #2533

Checklist

Before submitting the PR, please check following (checks which are not relevant may be ignored):

Documentation is updated. See difference between snapshot and release documentation