Skip to content

chain-method-continuation

Kotlinstyleno fixdefault: offkotlin/ktlint

Reports a call chain (a.b().c(), with ?. too) whose line breaks differ from what the formatter writes.

A chain that is broken in some places and not in others hides which calls belong together, and a later edit adds or moves breaks. One layout for all chains makes each step visible and keeps the diff small.

To fix, run the formatter.

Reported
...
}
foo(); bar()
val c = someVeryLongReceiverName.firstFunctionCall(argumentNumberOne).secondFunctionCall(argumentNumberTwo).thirdFunctionCall(argumentNumberThree)
...
}
kotlin:
lint:
rules:
chain-method-continuation: warn # off (default), warn, error

Enabled by the presets: kotlin/ktlint.

Suppress one line with sudsy-disable-next-line chain-method-continuation 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 chain-method-continuation full