autopep8
autopep8 copied to clipboard
Max-line-length is ignored, has no effect
The docs for E501 specify "Try to make lines fit within --max-line-length characters."
Therefore, if I wanted to use autopep8 to only reformat line length, I would presumably run:
autopep8 --max-line-length <length> --in-place --recursive --select=E501 somefile.py
However, I'm finding this command has no effect. On a file with code in excess of 100 columns, running:
autopep8 --max-line-length 80 --in-place --recursive --select=E501 somefile.py
does not modify the file in any way, when I would expect it to reformat code into continuations and wrap docstrings and comments.
I'm running autopep8 1.4.4
with Python 3.7.3
.
same problem. sad.
It has no effect unless you give any of the -a
, -aa
, -aaa
options.
I'm also seeing no effect, even with the any number of -a
options. Even if I try running this on the sample code in the readme, line length is not being corrected.
1.4.3 seems fine with -a
, 1.4.4 seems to not handle line length at all
autopep8 1.5.4 (pycodestyle: 2.6.0)
splits lines with autopep8 --in-place address_imported_cities.py -a --jobs 0
and autopep8 --in-place address_imported_cities.py -aa --jobs 0
commands.
Both are not working as I would expect (I will file issue if PEP8 agrees with me), but there is some effect.
@chrisspen Can you present code that is not processed properly?
2 april 2021: autopep8-1.5.6 pycodestyle-2.7.0
still not working with --max-line-length
.
@zensimilia Can you give example of code not working as expected?
@matkoniecz this one:
from app.module.long.name import function_one, function_two, function_with_long_name, function_for_test
def my_super_test_function(argument: str, test_passed: bool, so_long_string_for_test_purposes: str):
print('hello world')
command: autopep8 --max-line-length 80 --diff test.py
Here's another one:
(env) gmc@sunra:~/tmp$ autopep8 --version
autopep8 1.5.7 (pycodestyle: 2.7.0)
(env) gmc@sunra:~/tmp$ cat test.py
def foo():
print("way too long string should be split")
(env) gmc@sunra:~/tmp$ autopep8 test.py
def foo():
print("way too long string should be split")
(env) gmc@sunra:~/tmp$ autopep8 -a test.py
def foo():
print("way too long string should be split")
(env) gmc@sunra:~/tmp$ autopep8 -aa test.py
def foo():
print("way too long string should be split")
(env) gmc@sunra:~/tmp$ autopep8 -aaa test.py
def foo():
print("way too long string should be split")
(env) gmc@sunra:~/tmp$ autopep8 -aaa --experimental test.py
def foo():
print("way too long string should be split")
(env) gmc@sunra:~/tmp$
Same problem with autopep8 2.0.2