for name, index in zip(
[
"foo:",
"bar:",
],
range(5),
):
pass
warnings
No warnings
pylint 2.3.1
astroid 2.2.5
Python 3.7.3 (default, May 11 2019, 00:38:04)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Hi. Does it say that you need 2 extra spaces or 4? Can you paste the exact output you are receiving?
Sorry, here is the exact output. And indeed it says 4.
example.py:2:0: C0330: Wrong hanging indentation before block (add 4 spaces).
[
^ | (bad-continuation)
example.py:6:0: C0330: Wrong hanging indentation before block (add 4 spaces).
range(5),
^ | (bad-continuation)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
This is after ignoring module docstring warnings.
I reproduced the output (pylint 2.4.0-dev0):
example.py:2:0: C0330: Wrong hanging indentation before block (add 4 spaces).
[
^ | (bad-continuation)
example.py:6:0: C0330: Wrong hanging indentation before block (add 4 spaces).
range(5),
^ | (bad-continuation)
So at least we can remove "also does not show error code for it" from the issue title )
@LeptoSpira you could probably do what it wants, add 4 spaces:
for name, index in zip(
[
"foo:",
"bar:",
],
range(5),
):
pass
Checked both variants with pycodestyle - no warnings.
p.s. PyCharm reformats the code from issue into what I wrote above.
yapf formats it to without the 4 extra spaces, so I guess we should move this issue to the yapf repository?
yapf formats it to without the 4 extra spaces, so I guess we should move this issue to the yapf repository?
Unfortunately rules from pep8 in such case are not specific, and we don't have any solid arguments beside that
If that is so, I don't think the error should occur
Same thing happens with what black does with classes with many arguments:
class A:
def __init__(
self,
many,
long,
arguments,
passed,
here
)
...
pylint also complains about indentation here & wants 4 spaces to be added to each line with an argument.
Thanks for the reproducible case @lukaszdudek-silvair
I stumbled over this issue after using black to format the code.
Is there any progress on this?
bad-continuation has been removed in #3571, black or another formatter can help you with this better than Pylint
Most helpful comment
I stumbled over this issue after using
blackto format the code.