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.

Home Page:https://flake8.pycqa.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

E712 recommends "worse" option

Tom-Finke opened this issue · comments

how did you install flake8?

pre-commit https://github.com/pre-commit/pre-commit-hooks

unmodified output of flake8 --bug-report

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

describe the problem

what I expected to happen

Flake8 should recommend replacing "x == True" with just "x"
Instead it suggests using "x is True", which, according to the official Style guide (see https://peps.python.org/pep-0008/#programming-recommendations) is actually worse. Which makes sense, because x has to be True not truthy when using "is True"

See also grantmcconnaughey/Flake8Rules#58

sample code

x = 1
x == True

please read the issue template and the prompts next time -- this is not the place