question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chained call expressions are not indented.

See original GitHub issue

What 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:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
m59peacemakercommented, Jan 28, 2019

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.

1reaction
kaicataldocommented, Jan 28, 2019

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 key parenthesis?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found