Pylint: warn of redundant `pylint: disable` comments?
Question:
I created a class:
class Blahaj:
def swim(self):
...
# todo: consider other modes of transport
Pylint warned there were too few public methods, which I acknowledged by adding a # pylint: disable=too-few-public-methods
comment.
Now I’ve added more methods, is there a way to get Pylint to warn me that the earlier comment is now redundant?
class Blahaj: # pylint: disable=too-few-public-methods
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ now redundant
def swim(self):
...
def jump(self):
...
def fly(self):
...
def ski(self):
...
Answers:
Since you’ve manually disabled it, it won’t notify you about it anymore for that class. So to answer this, no. There is only your keen eye for re-evaluating disabled checks upon code change.
You can enable the useless-suppression
message
I created a class:
class Blahaj:
def swim(self):
...
# todo: consider other modes of transport
Pylint warned there were too few public methods, which I acknowledged by adding a # pylint: disable=too-few-public-methods
comment.
Now I’ve added more methods, is there a way to get Pylint to warn me that the earlier comment is now redundant?
class Blahaj: # pylint: disable=too-few-public-methods
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ now redundant
def swim(self):
...
def jump(self):
...
def fly(self):
...
def ski(self):
...
Since you’ve manually disabled it, it won’t notify you about it anymore for that class. So to answer this, no. There is only your keen eye for re-evaluating disabled checks upon code change.
You can enable the useless-suppression
message