Reputation: 604
I have flake8 installed in pipenv virtual environments on per project basis.
The flake8 docs state that:
Values set at the command line have highest priority, then those in the project configuration file, then those in your user directory, and finally there are the defaults.
As per the docs I created two .flake8 files:
When I run flake8 it picks up configuration options from a local file, but it completely ignores the global file.
How can I make flake8 see the global configuration file so I don't have to repeat some configuration options in every project?
Upvotes: 5
Views: 2779
Reputation: 29546
This answer is for flake8 < 4.0.0.
For flake8 4.0.0 and up, see farnsy's answer.
It can be a bit misleading, but the User Configuration section of the flake8 docs does mention a file:
Flake8 allows a user to use “global” configuration file to store preferences.
...
Note that Flake8 looks for
~\.flake8
on Windows and~/.config/flake8
on Linux and other Unix systems.
As answered in the comments, ~/.config/flake8
should be a file, not a directory.
Upvotes: 5
Reputation: 2470
Note that as of flake8 4.0, flake8 no longer supports a global config file at all. I don't know what could motivate such a horrible idea, but that's where we are.
Lots of docs are not up to date on this, so maybe this answer will help guide some people who think flake8 is ignoring their global config due to user error. It's not you, it's them.
Upvotes: 18