flake8 not honoring global configuration. elpy
Asked Answered
P

2

14

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.

Periodicity answered 1/7, 2016 at 7:2 Comment(2)
Did you try running flake8 directly against the code that you're writing? If you do and have the same problem, can you share the output of flake8 -vFeoffee
This seems to be broken for me as well. If I have my configuration file in ~/.flake8, and I have my .py files in some subdirectory of ~/, then it picks up the file. This is not expected since I want a global location for this setup, and not have to copy the flake8 configuration settings across all projects I use.Costermansville
L
14

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.

Loudermilk answered 31/12, 2021 at 15:37 Comment(0)
I
3

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

Ifill answered 2/5, 2017 at 16:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.