-
Notifications
You must be signed in to change notification settings - Fork 507
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
Single-line chain method calls with operator #2712
Comments
This is exactly how the rule works. The outmost expression (parenthesis added for clarification) is The first part of this expression, When the first subexpression is shortened by remove one chain operation, you will see that the example is accepted by ktlint unchanged:
|
Hi Paul, thanks for clarifying. I missed the documented configuration of 4 chain method calls. However, explicitly setting Using the original code, I can only pass the check when val s =
result.value.drop(1).dropLast(1).lowercase() +
result.value.last() |
That is a good find. The code indeed sets the value to |
…ne_when_chain_operator_count_greater_or_equal_than when it has When value is set to "unset" the number of chain operators on a single line is not restricted as long as the max line length is not exceeded. Closes #2712
I have two strings, both are single-line chain method calls that do not violate the max lines rule.
When joined together with
+
operator, chain method continuation rule treats them as one statement. It demanded that the first chain be wrapped, but not the rest.Expected Behavior
When there are mathematical and comparison operators, chained calls of each operand should be inspected individually. Alternatively, force multi-lining on the rest of the operands.
Current Behavior
Additional information
The text was updated successfully, but these errors were encountered: