If I create a file test.py
with the following poorly-formatted contents:
import re
long_string = "foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
class Foo():
pass
and run flake8
on the file from the command-line like this:
$ flake8 --max-line-length=79 test.py
only two errors are reported:
test.py:1:1: F401 're' imported but unused
test.py:3:1: E302 expected 2 blank lines, found 0
The max-line-length
violation on line two is not reported.
Completely by accident (I was testing if any of the command options would be respected), I found that if I add an ignore option like this:
$ flake8 --max-line-length=79 --ignore=E302 test.py
Then the line length violation is reported:
test.py:1:1: F401 're' imported but unused
test.py:2:80: E501 line too long (97 > 79 characters)
I am on Ubuntu 16.04 and my flake8
version info is:
2.5.4 (pep8: 1.7.0, mccabe: 0.2.1, pyflakes: 1.1.0) CPython 3.5.1+ on Linux
When I posted a related question on the Emacs Stack Exchange site (I thought the issue was with an Emacs package initially), one of the users there pointed out that flake8
2.5.4 requires a lower version of pyflakes
. However, installing flake8
through apt
or pip
automatically installs that particular version of pyflakes
as a dependency, and I have been unable to get an older version of pyflakes
to see if that solves the problem (maybe that is another question altogether).
Am I doing something wrong here, or is this a bug?
ignore = E501
to my~/.config/flake8
at my previous job. Recently I updated my config by addingmax-line-length = 80
, but kept theignore
line, not realizing whatE501
corresponded to...I assume then, that when I added--ignore=E302
as a command-line option, I was this overriding theignore
options in the~/.config/flake8
. Thanks for the help! – Donell