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.39k stars 306 forks source link

pycodestyle entry point means "noqa" is not populated #1915

Closed ipolding-cais closed 6 months ago

ipolding-cais commented 6 months ago

how did you install flake8?

$ pip install flake8

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.10.13",
    "system": "Darwin"
  },
  "plugins": [
    {
      "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

what I expected to happen

Flake8 should give the same output as pycodestyle when selecting E501 but pycodestyle's noqa argument is set to false in flake8

Here is the noqa attribute that should be populated: https://github.com/PyCQA/pycodestyle/blob/main/pycodestyle.py#L1721

...

sample code

print("this line has 65 characters plus an example noqa comment")# noqa: B018

commands ran

$ pycodestyle --max-line-length 65 --select E501 code_sample.py # no errors; noqa comment is ignored
$ flake8 --max-line-length 65 --select E501 code_sample.py # E501 error; noqa comment is included as part of line
asottile commented 6 months ago

pycodestyle's interpretation of noqa does not include codes and is intentionally different from the improvements made in flake8