-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WRONG_INDENTATION
continuation indent expected in if
-expression
#1351
Comments
WRONG_INDENTATION
] continuation indent expected in if expression
WRONG_INDENTATION
] continuation indent expected in if expressionWRONG_INDENTATION
] continuation indent expected in if
-expression
Reg. No. 2, from IDEA standpoint, you get a relative indent of 8 (an absolute indent of 16), because IDEA combines a single indent within an val prevComment = if (valueParameterNode.siblings(forward = false)
.takeWhile { it.elementType != EOL_COMMENT && it.elementType != BLOCK_COMMENT }
.all { it.elementType == WHITE_SPACE }
) {
// block body
} Minimal repro: if (""
.isBlank()) {
// block body
} while (""
.isBlank()) {
// block body
} do {
// block body
} while (""
.isBlank()) This behaviour is documented in this Wiki section. |
No. 1 is a separate matter. While all these are correctly formatted (IDEA and diKTat behave consistently): if (true &&
true &&
false) {
return
}
if (true ||
true ||
false) {
return
}
if (true &&
true ||
false) {
return
} — here's the minimal repro: if (true ||
true &&
false) {
return
} Apparently, this is something related to operator priorities (see 3.5 Line length), since adding parentheses around the 1st two booleans immediately "fixes" the issue (and modifies the logic): if ((true ||
true) &&
false) {
return
} Another minimal repro: if (1 +
2 *
3 == 7) {
return
} And two more, w/o any val a = true ||
true &&
true
val b = 1 +
2 *
3 In this latter case, IDEA would disregard any operator priorities and simply use a (continuation) indent of 8. |
…ates ### What's done: * Unit tests added which cover indentation in `if`- and `while`-expression predicates. * See #1351.
WRONG_INDENTATION
] continuation indent expected in if
-expressionWRONG_INDENTATION
continuation indent expected in if
-expression
Describe the bug
Expected behavior
there should be no error after idea style applying
Observed behavior
Steps to Reproduce
KdocComments
you have the following piece of codebut diktat report error as far as it expect continuation indent in the last line of if expression like this
but diktat report error as far as it expect 12 spaces instead 16 as below
Environment information
The text was updated successfully, but these errors were encountered: