Chained call expressions are not indented.
See original GitHub issueWhat rule do you want to change?
indent
Does this change cause the rule to produce more or fewer warnings? Fewer.
How will the change be implemented? (New option, new default behavior, etc.)? New default behavior with new option to configure it.
Examples:
incorrect code
foo
(123)
(456)
correct code
foo
(123)
(456)
What does the rule currently do for this code? Chaining function invocations across multiple lines (when permitted by func-call-spacing) expects no indentation.
What will the rule do after it’s changed? Chaining function invocations should be indented by default in the same manner as chaining member method invocations, with the same options for configuration.
foo
.bar(123)
.baz(456)
foo
(123)
(456)
Are you willing to submit a pull request to implement this change? I am willing to try!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Chained method calls indentation style in Python [duplicate]
What about no-arguments methods? How to write them on multiple lines without referencing the intermediate return values? ShortName.objects.
Read more >Java Formatting - Continuation Indent in Chained Method Calls
The issue is that it will start counting continuation indent not from the beginning of the line, but rather from the beginning of...
Read more >Ruby Style Guide
Use only spaces for indentation. No hard tabs. Indentation. Use two spaces per indentation level (aka soft tabs).
Read more >Python: Formatting Chained Methods - Ken Goettler
The Python PEP8 style guide does not clearly specify how one should format chained method calls. With the pandas library, chained method ...
Read more >489444 – [Formatter] Chained method calls when ... - Bugs
The problem: There is currently no combination of settings that allow Eclipse to format this code in the following way: int someValue =...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s a critical issue for me, as my primary paradigm is dominated with curried functions that have chained invocations in this way. Single line expressions in this manner are often far worse than the lack of indentation or having to keep the indent rule disabled. Here is a thread about a code style for which multiline call expression indentation is necessary.
This seems like a reasonable enhancement to me - the “correct” example above is what I would expect the rule to enforce by default. Could the option be part of the
CallExpression
config object? Maybe with the keyparenthesis
?