flake8 exclude entire directory with whitespace in name

3057 views python
5

I have a directory called "Old stuff" that I want flake8 to not lint code in this directory.

What is the correct syntax to exclude it?

I looked at the documentation for configuring flake8 but did not find what I wanted.

I tried in my .flake8 file:

[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 of those syntax works.

Same problem when trying to exclude on the command line:

flake8 --exclude=Old\ stuff

answered question

1 Answer

4

To get flake8 to ignore the directory with the whitespace, this syntax works:

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

For the command line:

flake8 --exclude=Old*stuff

posted this

Have an answer?

JD

Please login first before posting an answer.