diktat icon indicating copy to clipboard operation
diktat copied to clipboard

LineLength rule does wrong formatting

Open sanyavertolet opened this issue 4 years ago • 2 comments

Here is an example:

fun test() {
    val foo = (hasExplicitNotUnitReturnType || isFunWithExpressionBody && !hasExplicitUnitReturnType && hasNotExpressionBodyTypes)
            && !hasReturnKdoc && !isReferenceExpressionWithSameName
}

which is transformed to this code (in LineLength):

fun test() {
    val foo = (hasExplicitNotUnitReturnType || isFunWithExpressionBody && !hasExplicitUnitReturnType &&
 hasNotExpressionBodyTypes)
            && !hasReturnKdoc && !isReferenceExpressionWithSameName
}

sanyavertolet avatar Nov 16 '21 12:11 sanyavertolet

To my mind it should be something like that:

fun test() {
    val foo = (hasExplicitNotUnitReturnType || isFunWithExpressionBody && !hasExplicitUnitReturnType &&
 hasNotExpressionBodyTypes) && !hasReturnKdoc && !isReferenceExpressionWithSameName
}

(for 120 characters)

sanyavertolet avatar Nov 16 '21 12:11 sanyavertolet

not critical at all

orchestr7 avatar Jan 26 '22 09:01 orchestr7