diff -r 12d917813110 -r ffc31e1cff4e Plugins/CheckerPlugins/CodeStyleChecker/DocStyleChecker.py --- a/Plugins/CheckerPlugins/CodeStyleChecker/DocStyleChecker.py Tue Jul 18 19:14:20 2017 +0200 +++ b/Plugins/CheckerPlugins/CodeStyleChecker/DocStyleChecker.py Wed Jul 19 19:48:38 2017 +0200 @@ -51,6 +51,7 @@ self.__start = startLine self.__indent = "" self.__type = contextType + self.__special = "" # ensure first line is left justified if self.__source: @@ -105,6 +106,24 @@ @return context type (string) """ return self.__type + + def setSpecial(self, special): + """ + Public method to set a special attribute for the context. + + @param special attribute string + @type str + """ + self.__special = special + + def special(self): + """ + Public method to get the special context attribute string. + + @return attribute string + @rtype str + """ + return self.__special class DocStyleChecker(object): @@ -619,9 +638,17 @@ end = line - 1, char startLine = classContext.start() + start[0] endLine = classContext.start() + end[0] - contexts.append(DocStyleContext( + context = DocStyleContext( self.__source[startLine:endLine], - startLine, "def")) + startLine, "def") + if startLine > 0: + if self.__source[startLine - 1].strip() == \ + "@staticmethod": + context.setSpecial("staticmethod") + elif self.__source[startLine - 1].strip() == \ + "@classmethod": + context.setSpecial("classmethod") + contexts.append(context) except StopIteration: pass self.__methodsCache = contexts @@ -1365,10 +1392,15 @@ if firstWord != 'protected': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'protected') - elif arguments.startswith(('cls,', 'cls)')): + elif arguments.startswith(('cls,', 'cls)')) or \ + context.special() == "classmethod": if firstWord != 'class': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'class') + elif context.special() == "staticmethod": + if firstWord != 'static': + self.__error(docstringContext.start() + lineNumber, 0, + "D232", 'static') else: if firstWord != 'public': self.__error(docstringContext.start() + lineNumber, 0,