pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.06k stars 504 forks source link

Handle trailing space on preceding line in call to `lineLengthWithoutNewlinePrefix` #2644

Closed paul-dingemans closed 2 months ago

paul-dingemans commented 2 months ago

Description

If first line in code below ends with a trailing space, an exception was thrown when calling method lineLengthWithoutNewlinePrefix for a node on line 2:

val foo1 = "foo1"
val foo2 = "foo2"

Checklist

Before submitting the PR, please check following (checks which are not relevant may be ignored):

Documentation is updated. See difference between snapshot and release documentation