hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.58k stars 291 forks source link

Identifier split into two when using ignore=W503 #606

Open mattearllongshot opened 3 years ago

mattearllongshot commented 3 years ago

See below. Notice that abcd becomes a bcd in the modified version. It seems sensitive to various things, eg. length of the identifier, line breaks.

Python Code

~/junk/autopep8_bug.py

if (
        X or
        abcd/Y
):
    pass

Command Line and Configuration

~/junk/pycodestyle.repro

[pycodestyle]
ignore = W503

Command Line

$ autopep8 --global-config ~/junk/pycodestyle.repro --diff ~/junk/autopep8_bug.py 
--- original//home/matthew/junk/autopep8_bug.py
+++ fixed//home/matthew/junk/autopep8_bug.py
@@ -1,6 +1,5 @@
 if (
-        X or
-        abcd/Y
+        X
+        or a bcd / Y
 ):
     pass

Your Environment