排除名称中包含空格的整个目录

Exclude entire directory with whitespace in name

我有一个名为 "Old stuff" 的目录,我希望 flake8 不在该目录中执行 lint 代码。

排除它的正确语法是什么?

我看了 documentation 配置 flake8 但没有找到我想要的。

我在 .flake8 文件中尝试过:

[flake8]
max-line-length = 99
exclude =
    # Don't check the Old directories
    # Attempt 1
    Old\ stuff
    # Attempt 2
    "Old stuff"
    # Attempt 3
    /Old stuff/
    # Attempt 4
    ./Old stuff/
    # Attempt 5
    /Old\ stuff/

None 这些语法有效。

尝试在命令行中排除时出现同样的问题:

flake8 --exclude=Old\ stuff

要让 flake8 忽略带有空格的目录,此语法有效:

[flake8]
max-line-length = 99
exclude =
    # Don't check the Old directories
    Old*stuff

对于命令行:

flake8 --exclude=Old*stuff