Skip to content

argument-list-wrapping

Kotlinstyleno fixdefault: offkotlin/ktlint

Reports an argument list of a call that the Kotlin formatter would wrap or join differently: the arguments on one line when they fit, one per line when they do not.

A call whose arguments are wrapped in a mixed way (two on the first line, the rest below, aligned to the bracket) is hard to scan and makes a diff show a change on every line when one argument is renamed. One layout for all lists lets the formatter apply it and keeps the diffs small.

To fix, run the formatter, which lays the list out.

Reported
...
}
foo(); bar()
...
callTheFunction(argumentNumberOne, argumentNumberTwo, argumentNumberThree, argumentNumberFour, argumentNumberFive, argumentNumberSix, argumentNumberSeven)
}
kotlin:
lint:
rules:
argument-list-wrapping: warn # off (default), warn, error

Enabled by the presets: kotlin/ktlint.

Suppress one line with sudsy-disable-next-line argument-list-wrapping 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 argument-list-wrapping full