Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flake8 not honoring global configuration. elpy

I am new to emacs & trying to use it for python programming. I have installed elpy & everything is working fine except one thing - I am getting lot of warnings, errors like E401, E402, E501 etc. All are in scary red colors.

After researching little bit, it looks like these errors are coming from flake8. So I configure flake8 as follows:

In ~/.config/flake8,

[flake8]
ignore=E201,E203,E211,E221,E272,E251,E211,E222,E226,E228,E241,E301,E302,E401,E402,E501,E701,F401
max-line-length=160
exclude=tests/*
max-complexity=10

But still those errors are coming. I also configured same way PEP8 & pycodestyle in .config/. But no progress. I tried to put setup.cfg & tox.ini in project root, but that also didn't work.

For more information, there is similar ticket in sublime flake8 repo. https://github.com/SublimeLinter/SublimeLinter-flake8/issues/24

Please let me know if there is any working solution or emacs hacks.

Following are some details

Os - Linux Mint 17.3 Rosa
flake8 version - 3.0.0b1 (pyflakes: 1.2.3, pycodestyle: 2.0.0, mccabe: 0.5.0)
GNU Emacs 24.3.1

Thanks in advance.

like image 833
pokiri Avatar asked Jul 01 '16 07:07

pokiri


2 Answers

Try restarting emacs. For me it picks up ~/.config/flake8 when emacs is started, but doesn't pick it up between runs.

like image 89
John Lawrence Aspden Avatar answered Nov 17 '22 10:11

John Lawrence Aspden


Anyone trying to get this running for flake8>=4.0.0, that's because support for global config file is no longer present, see https://flake8.pycqa.org/en/latest/release-notes/4.0.0.html#backwards-incompatible-changes.

like image 34
user3496912 Avatar answered Nov 17 '22 10:11

user3496912