排除名称中带有空格的整个目录

问题描述 投票:0回答:1

我有一个名为“Old stuff”的目录,我希望

flake8
不要在此目录中检查代码。

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

我查看了文档来配置

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/

这些语法都不起作用。

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

flake8 --exclude=Old\ stuff
python flake8 linter
1个回答
2
投票

要让

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

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

对于命令行:

flake8 --exclude=Old*stuff
© www.soinside.com 2019 - 2024. All rights reserved.