blank-line-between-declarations
What it does
Section titled “What it does”Reports a declaration (function, property, class, object, typealias) with a blank line before it that the formatter would add or remove. Declarations with comments or annotations before them are included.
Why it matters
Section titled “Why it matters”Blank lines show where one declaration ends and the next one begins. A file that is consistent shows the structure at a glance, and a formatter that keeps the same spacing does not turn up as a diff on each save.
To fix, run the formatter.
Example
Section titled “Example”val a = 1// about bval b = 2
@Deprecated("x")...Configuration
Section titled “Configuration”kotlin: lint: rules: blank-line-between-declarations: warn # off (default), warn, errorEnabled by the presets: kotlin/ktlint.
Suppress one line with sudsy-disable-next-line blank-line-between-declarations in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ktlint | spacing-between-declarations-with-annotations |
full |
| ktlint | spacing-between-declarations-with-comments |
full |