PyCQA / pycodestyle

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

Fails to detect `E713 test for membership should be 'not in'` when left side more complex than simple variable #1212

Closed Kache closed 9 months ago

Kache commented 9 months ago
var = {'foo': 3}

if not var in [1, 2, 3]:  # detected
    pass

# all the below are not detected

if not var['foo'] in [1, 2, 3]:
    pass

if not str(var) in [1, 2, 3]:
    pass

if not var.keys() in [1, 2, 3]:
    pass

edit

sorry, dupe of #334

asottile commented 9 months ago

please search the issue tracker next time. I've put in a bunch of work to make it easy to search by code