Prevent exception in binary-expression-wrapping rule by paul-dingemans · Pull Request #2607 · ktlint/ktlint (original) (raw)

@paul-dingemans

…preceded on the same line by a block comment containing a newline character

Function leavesOnLine calls function getFirstLeafOnLineOrSelf which finds the first leaf on the line by looking for newline character. A block comment containing a newline character resulted in considering that block comment to be the first element on the line, even in case it was preceded by other elements on the same line.

Due to this change, the max-line-length rule failed, which has been resolved by refactoring the calculation of the line length.

Closes #2601

@paul-dingemans added this to the 1.2.2 milestone

Mar 12, 2024

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})