Hi, Attached is .diff file on a proposed fix for pylint #4581: option to NOT get a Missing docstring (C0111) warning if a method is overridden.
All I did was: - add an option, no-docstring-overridden that when invoked --no-docstring-overridden=y, it won't check the docstring for a method that is overridden. ('no-docstring-overridden', {'default' : 0, 'type' : 'yn', 'metavar' : '<y or n>', 'help': 'No docstring for overriden methods.'} ), - changed visit_function(), checked if the node passed was already in one of its ancestors. def visit_function(self, node): ..... # docstring if self.config.no_docstring_rgx.match(node.name) is None: if self.config.no_docstring_overridden: overridden = False # check if node is from a method overridden by its ancestor for ancestor in node.parent.frame().ancestors(): if node.name in ancestor and \ isinstance(ancestor[node.name], astng.Function): overridden = True if not overridden: self._check_docstring(f_type, node) else: self._check_docstring(f_type, node) # check default arguments' value .... I also have two test cases that I used. One is a simple bank/interest file and another is just dealing with multiple inheritance. Hope this is fine with you. Donovan Lee Wanhoy Team Tahiti University of Toronto
C0111.diff
Description: Binary data
bank.py
Description: Binary data
test.py
Description: Binary data
_______________________________________________ Python-Projects mailing list Python-Projects@lists.logilab.org http://lists.logilab.org/mailman/listinfo/python-projects