Skip to content

trailing-comma-on-call-site

Kotlinstyleno fixdefault: offkotlin/ktlint

Reports the last argument of a multi-line call that has a trailing comma the formatter would add or remove.

With a trailing comma, adding an argument at the end changes one line instead of two, and moving arguments does not need the comma moved. A project that chooses one form gets the same diff everywhere.

To fix, run the formatter.

Reported
...
...
1,
2
)
fun bar(
...
kotlin:
lint:
rules:
trailing-comma-on-call-site: warn # off (default), warn, error

Enabled by the presets: kotlin/ktlint.

Suppress one line with sudsy-disable-next-line trailing-comma-on-call-site 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 trailing-comma-on-call-site full