flake8 没有在用户目录中获取全局配置文件

flake8 is not picking up global configuration file in user directory

我在每个项目的基础上在 pipenv 虚拟环境中安装了 flake8。

flake8 文档指出:

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.

根据文档,我创建了两个 .flake8 文件:

  1. 在项目根目录中 - 针对每个项目配置
  2. /Users/rusl/.config/flake8/.flake8 - 用于全局配置

当我 运行 flake8 时,它会从本地文件中获取配置选项,但它会完全忽略全局文件。

如何让 flake8 看到全局配置文件,这样我就不必在每个项目中重复一些配置选项?

这可能有点误导,但 flake8 文档的 User Configuration 部分确实提到了 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.

因为~/.config/flake8应该是文件,而不是目录。