klen / pylama

Code audit tool for python.
MIT License
1.05k stars 99 forks source link

Fix to adapt to messages removed at pyflakes 2.5.0 #225

Closed thombashi closed 2 years ago

thombashi commented 2 years ago

Fix #224

RedefinedInListComp and ReturnWithArgsInsideGenerator were removed at pyflakes 2.5.0: https://github.com/PyCQA/pyflakes/commit/2246217295dc8cb30ef4a7b9d8dc449ce32e603a

guyrt commented 2 years ago

Hi! Any chance you could add these two keys to dictionary in a try catch and catch AttributeError for missing keys? This will maintain backwards compat with pyflakes 2.4 users rather than silently changing what gets flagged.

Something like

CODES = {...}

try:
    CODES[m.RedefinedInListComp.message] = "W0621"
except AttributeError:
    pass 
thombashi commented 2 years ago

Thank you for your feedback. I modified the PR to keep backward compatibility.