-
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
: extendedIndentAfterOperators
ignored if lines are wrapped before a binary operator or an infix function
#1340
Comments
WRONG_INDENTATION
: extendedIndentAfterOperators
ignored if lines are wrapped *before* a binary operator or an infix functionWRONG_INDENTATION
: extendedIndentAfterOperators
ignored if lines are wrapped _before_ a binary operator or an infix function
WRONG_INDENTATION
: extendedIndentAfterOperators
ignored if lines are wrapped _before_ a binary operator or an infix functionWRONG_INDENTATION
: extendedIndentAfterOperators
ignored if lines are wrapped before a binary operator or an infix function
### What's done: * Tests for expressions wrapped on an operator have been added. * Both cases (when `extendedIndentAfterOperators` is `true` and `false`) are tested. * Both binary operators and functions are tested. * Related: #1340
### What's done: * Tests for expressions wrapped on an operator have been added. * Both cases (when `extendedIndentAfterOperators` is `true` and `false`) are tested. * Both binary operators and functions are tested. * Related: #1340
#1401) * `WRONG_INDENTATION`: add more tests for `extendedIndentAfterOperators` ### What's done: * Tests for expressions wrapped on an operator have been added. * Both cases (when `extendedIndentAfterOperators` is `true` and `false`) are tested. * Both binary operators and functions are tested. * Test resources extracted into a separate class so that DeteKT remains quiet. * Related: #1340
|
### What's done: * Now, the indentation in binary expressions wrapped *before* a binary operator or an infix function is also controlled with `extendedIndentAfterOperators`. * The above is also true for `as` and `as?` operators. * The only exclusion is the Elvis operator (`?:`). * Fixes #1340.
### What's done: * Now, the indentation in binary expressions wrapped *before* a binary operator or an infix function is also controlled with `extendedIndentAfterOperators`. * The above is also true for `as` and `as?` operators. * The only exclusion is the Elvis operator (`?:`). * Fixes #1340.
Consider this fragment (originally from #1312 (comment))
Here, infix function calls are wrapped before the operator (the infix function), and
extendedIndentAfterOperators
has no effect (DiKTat always expects a single indent, not a continuation indent).The workaround (fir version 1.1.0) is to reformat the code as follows (#1312 (comment)):
The expected behaviour is that
extendedIndentAfterOperators
is honored regardless of whether the code is wrapped before or after a binary operator.Other examples (the code style assumes
extendedIndentAfterOperators
is on):when
- andfor
-statementsThe argument of a
when
-expression:The branch condition of a
when
-expression:Infix function calls in a
for
-loop:Operator function calls in a
for
-loop:More examples
Expressions wrapped in parentheses
Affected by the fix for #1409, see this comment.
if
-conditions (should be controlled by a separate flag)A slightly modified example from IDEA code style settings (
CONTINUATION_INDENT_IN_IF_CONDITIONS
is on):Minimal repro:
or
Environment information
mvn diktat:check
The text was updated successfully, but these errors were encountered: