Open gao-xuejian opened 6 years ago
@jayvdb can i be assigned to this one
This is also failing from me. It does not work when passed as part of the options in a python call.
try using this option together with --aggressive 2
I can reproduce this bug. Autopep8 seems to largely ignore the --max-line-length
setting. Even with three "aggressive" flags, that only made it wrap a long comment, but not a docstring or if statement. Is enforcing line length not a supported feature yet?
Here is an example case.
(autopep8-test) ~/w/autopep8-test@ autopep8 --version
autopep8 1.4.4 (pycodestyle: 2.5.0)
(autopep8-test) ~/w/autopep8-test@ cat main.py
def foo(arg1, arg2, tooooooooooooooooooooooooooooooooooooooooooooooooooolongarg):
pass
(autopep8-test) ~/w/autopep8-test@ autopep8 -v -v --max-line-length=80 main.py
[file:main.py]
---> Applying global fix for E265
---> 1 issue(s) to fix {'E501': {1}}
---> Not fixing E501 on line 1
def foo(arg1, arg2, tooooooooooooooooooooooooooooooooooooooooooooooooooolongarg):
pass
In this case, compile()
in check_syntax()
throws SyntaxError for fix candidates, e.g.
def foo(arg1,
arg2, tooooooooooooooooooooooooooooooooooooooooooooooooooolongarg):
There may be alternatives for the syntax checker, such as codeop.compile_command()
or ast.parse()
, but they might cause additional issues.
I want to limit the length of each line to less than 80,But parameter “--max-line-length 79” does not take effect.