Search code examples
pythonpython-2.7pylint

Can I have pylint warn of suppression lines that would be unnecessary?


With pylint, is it possible to tell it to output warnings on lines that explicitly disable a particular warning, but where the warning doesn't actually occur?

The idea here would be that sometimes I'd like to clean up the suppression lines I added, after refactoring the code.

Now the obvious method would be to remove all suppression lines and then add them back one by one. But since pylint knows about the code and what I ask of it using suppression lines, it'd be better equipped to point out unnecessary suppression lines.

Can pylint do this?

I tried to search for this feature, but came up empty-handed. So I probably picked the wrong search terms.


Solution

  • I think you are looking for useless-suppression, as in pylint --enable=useless-suppression. It is disabled by default.