PyCQA / pycodestyle

Simple Python style checker in one Python file
https://pycodestyle.pycqa.org
Other
5.03k stars 753 forks source link

E713: false negatives #334

Open rkday opened 10 years ago

rkday commented 10 years ago

I was looking into https://github.com/jcrocholl/pep8/issues/330, and I noticed that the following don't cause E713 when they should:

if not (X) in Y:
    pass
if not X() in Y:
    pass

Looks like the regular expression is picking up the ( between not and in and wrongly deciding that this is something of the form:

if not (X in Y or X is Z):
    pass
asottile commented 4 years ago

583 has a few additional cases for this as well

spreiter commented 3 years ago

With pycodestyle 2.6.0 (as part of flake8 3.8.4) the following is not detected.

asic = 'abc'
if not asic[0] in ["D", "R", "S"]:
    print("Unknown ASIC %s!" % (str(asic)))

After removing the index [0] the wrong order is detected correctly.

spaceone commented 1 year ago

if not "foo%s" % bar in baz: is also not detected.

joeyorlando commented 7 months ago

I've recently run into (what seems like) a 🐛 for E713:

logger.info(f"{self.organization_public_primary_key} not found in destination, no cleanup to do.")

Getting:

engine_enterprise/apps/cluster_migration/organization_migrator.py:193:66: E713 test for membership should be 'not in'

Seems like it's considering the not found in part of my string 🤔

asottile commented 7 months ago

you're using an old version of pycodestyle