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.

pokiri
  • 141
  • 1
  • 4
  • 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 -v` – Ian Stapleton Cordasco Jul 02 '16 at 21:01
  • 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. – bgoodr Mar 26 '17 at 01:15

2 Answers2

11

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.

user3496912
  • 195
  • 1
  • 6
3

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

John Lawrence Aspden
  • 17,124
  • 11
  • 67
  • 110