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

[BUG] Doesn't work with very long lines (or just large files) #524

Open hXtreme opened 4 years ago

hXtreme commented 4 years ago

Command Line

Command Line

$ autopep8 -i ./lut.py

Here's the file: lut.py

When I run the above command autopep8 maxes out my CPU usage and does nothing(at least in terms of output), I've waited for more than 10 minutes with only a blank shell.

Checking the file after terminating the application with Ctrl+C shows no changes written to the file.

Following the advice on Contributing guidelines I also ran pycodestyle which runs without a hitch and finishes up in under 30 seconds with the following output:

./lut.py:1:9: E201 whitespace after '['
./lut.py:2:3: E128 continuation line under-indented for visual indent
./lut.py:2:4: E201 whitespace after '['
./lut.py:3:4: E201 whitespace after '['
./lut.py:4:4: E201 whitespace after '['
./lut.py:4:80: E501 line too long (124 > 79 characters)
./lut.py:5:4: E201 whitespace after '['
./lut.py:5:80: E501 line too long (252 > 79 characters)
./lut.py:6:4: E201 whitespace after '['
./lut.py:6:80: E501 line too long (536 > 79 characters)
./lut.py:7:4: E201 whitespace after '['
./lut.py:7:80: E501 line too long (1176 > 79 characters)
./lut.py:8:4: E201 whitespace after '['
./lut.py:8:80: E501 line too long (2456 > 79 characters)
./lut.py:9:4: E201 whitespace after '['
./lut.py:9:80: E501 line too long (5040 > 79 characters)
./lut.py:10:4: E201 whitespace after '['
./lut.py:10:80: E501 line too long (11184 > 79 characters)
./lut.py:11:4: E201 whitespace after '['
./lut.py:11:80: E501 line too long (23472 > 79 characters)
./lut.py:12:4: E201 whitespace after '['
./lut.py:12:80: E501 line too long (48048 > 79 characters)
./lut.py:13:4: E201 whitespace after '['
./lut.py:13:80: E501 line too long (103584 > 79 characters)
./lut.py:14:4: E201 whitespace after '['
./lut.py:14:80: E501 line too long (218273 > 79 characters)
./lut.py:14:218272: E231 missing whitespace after ','

Your Environment

hhatto commented 4 years ago

same #521

hXtreme commented 4 years ago

They definitely seem related but I doubt they're the same. In #521 autopep8 terminates(with no output) in my case it doesn't terminate at all.