trailing-comma-on-declaration-site
What it does
Section titled “What it does”Reports the last parameter of a multi-line declaration that has a trailing comma the formatter would add or remove.
Why it matters
Section titled “Why it matters”With a trailing comma, adding a parameter at the end changes one line instead of two, and reordering parameters does not need the comma moved.
To fix, run the formatter.
Example
Section titled “Example”... val b: Int) {...
...
fun bar( a: Int, b: Int ) = a + b
fun ok(a: Int) = a...Configuration
Section titled “Configuration”kotlin: lint: rules: trailing-comma-on-declaration-site: warn # off (default), warn, errorEnabled by the presets: kotlin/ktlint.
Suppress one line with sudsy-disable-next-line trailing-comma-on-declaration-site 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 | trailing-comma-on-declaration-site |
full |