PyCQA / flake8

flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.
https://flake8.pycqa.org
Other
3.43k stars 307 forks source link

Trailing slash breaks exclude and extend-exclude config #1919

Closed remisalmon closed 8 months ago

remisalmon commented 8 months ago

how did you install flake8?

> pipx install flake8-bugbear --include-deps --force

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.11.8",
    "system": "Darwin"
  },
  "plugins": [
    {
      "plugin": "flake8-bugbear",
      "version": "24.2.6"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.11.1"
    },
    {
      "plugin": "pyflakes",
      "version": "3.2.0"
    }
  ],
  "version": "7.0.0"
}

describe the problem

Folders with trailing slashes in the exclude or extend-exclude in ~/.flake8 are ignored:

> cat ~/.flake8
[flake8]
exclude = Bug/
> flake8 --config ~/.flake8 .
./Bug/test.py:3:1: B001 Do not use bare `except:`, it also catches unexpected events like memory errors, interrupts, system exit, and so on.  Prefer excepting specific exceptions  If you're sure what you're doing, be explicit andwrite `except BaseException:`.
./Bug/test.py:3:1: E722 do not use bare 'except'
> flake8 --exclude Bug/ .
>

I think this is the exact same issue as https://github.com/PyCQA/flake8/issues/738 that is 3 years old?

asottile commented 8 months ago

~/.flake8 is not a supported flake8 configuration