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.47k stars 309 forks source link

Contradictory reports #1866

Closed sobomax closed 1 year ago

sobomax commented 1 year ago

how did you install flake8?

$ pip install flake8

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.10.12",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.11.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.1.0"
    }
  ],
  "version": "6.1.0"
}

describe the problem

what I expected to happen

Well, it gave me W504 first for not having "\" after arithmetic operator, but after fixing that it failed with E502 for having a redundant backslash between brackets. Which is kind of contradictory and circular.

sample code

                        audio_flt = audio_flt[:, audio_start:audio_start + \
                                              self.segment_size]

commands ran

$ flake8 --format="%(code)s|%(path)s:%(row)d|%(text)s" --exit-zero --ignore=I000
...

.flake8 is as follows

[flake8]
exclude = venv
count = True
show-source = True
statistics = True

some output & references

https://github.com/sobomax/hifi-gan-lsr-rt/actions/runs/6045220562/job/16404944855 https://github.com/sobomax/hifi-gan-lsr-rt/actions/runs/6045212091/job/16404920916

ScreenShot1098 ScreenShot1097

asottile commented 1 year ago

W504 is "there is a line break after a binary operator" not "add a backslash after a binary operator" -- also it is off by default so you've opted into it (usually by misusing exclude when you mean extend-exclude). also there are no checks implemented here -- please don't ignore the messaging in the issue template and issue form