yapf --style=pep8 continuation line may not distinguish itself from next line
See original GitHub issueThe following code:
class Foo(object):
def bar(self):
if self.solo_generator is None and len(
self.generators + self.next_batch) == 1:
pass
reformats as
class Foo(object):
def bar(self):
if self.solo_generator is None and len(
self.generators + self.next_batch) == 1:
pass
Which the pep8 error checker says “E125 continuation line with same indent as next logical line” to
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Continuation line with same indent as next logical line (E125)
Continuation lines should not be indented at the same level as the next logical line. Instead, they should be indented to one more...
Read more >Diff - platform/external/yapf - Google Git
+- A non-multiline string may have newlines if it contains continuation markers + itself. Don't add a newline after the string when retaining...
Read more >Define functions with too many arguments to abide by PEP8 ...
Personally I detest this approach, in which continuation lines have leading whitespace that doesn't correspond to any real indentation level. My approach would...
Read more >How to Write Beautiful Python Code With PEP 8 - Real Python
PEP 8 outlines ways to allow statements to run over several lines. Python will assume line continuation if code is contained within parentheses,...
Read more >Django: Reformatted code with Black | Hacker News
It even has a "black" compatible profile that line spits along black's defaults. ... Once the code is initially migrated (which should not...
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 Free
Top 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
It looks to me like this is still an issue when
dedent_closing_brackets: true
is used.This code aligns with PEP 8 recommendations:
Passing it through
yapf --style "{based_on_style: pep8, dedent_closing_brackets: true}" check.py
yields this:Which doesn’t align with PEP 8’s indentation recommendation and raises flake8’s “continuation line with same indent as next logical line” E125 error.
I’m having the same issue, is this fixed in version 0.3.1?