pythonflake8linter

Exclude entire directory with whitespace in name


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

Solution

  • 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