autopep8 icon indicating copy to clipboard operation
autopep8 copied to clipboard

indentation of lists in function arguments

Open philmayers opened this issue 8 years ago • 0 comments

autopep8 seems to turn this:

func([
    1,
    2,
    3,
    ],
    a=1,
    b=2,
    )

into this:

func([
    1,
    2,
    3,
],
    a=1,
    b=2,
)

...even though neither pep8 nor pycodestyle seem to detect the original indentation as problematic. While not wrong syntactically, it certainly looks odd, and the main thing is that neither pep8 nor pycodestyle themselves report the original code as problematic.

Where is autopep8 getting this from if not pycodestyle, and can it be suppressed?

Indentation and pep8/pycodestyle/autopep8 agree if the list opening bracket is moved to the next line.

$ ~/pyutils/bin/autopep8 --version
autopep8 1.3.1 (pycodestyle: 2.3.1)
$ ~/pyutils/bin/pycodestyle --version
2.3.1
$ ~/pyutils/bin/python --version
Python 2.7.13
$ uname -a
Linux flyingv.net.ic.ac.uk 4.10.10-200.fc25.x86_64 #1 SMP Thu Apr 13 01:11:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Have confirmed this occurs with latest autopep8

philmayers avatar May 02 '17 13:05 philmayers