pokiri
pokiri

Reputation: 151

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.

Upvotes: 15

Views: 4057

Answers (3)

quazgar
quazgar

Reputation: 4630

As @user3496912 correctly mentions, the global flake8 support was dropped in 4.0.

There is a workaround however: Put the configuration into a tox.ini in your home directory.

Caveat: I do not know if configuration files at deeper levels override settings from parent directories.

Upvotes: 0

user3496912
user3496912

Reputation: 385

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.

Upvotes: 16

John Lawrence Aspden
John Lawrence Aspden

Reputation: 17470

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

Upvotes: 3

Related Questions