UtilitiesPython2/Pep257CheckerPy2.py

changeset 2948
ea04689ee599
parent 2946
987b6368dbae
child 2949
e8f41288a688
equal deleted inserted replaced
2947:bd95f61c4f96 2948:ea04689ee599
814 if docstringContext is None: 814 if docstringContext is None:
815 return 815 return
816 816
817 functionName = context.source()[0].lstrip().split()[1].split("(")[0] 817 functionName = context.source()[0].lstrip().split()[1].split("(")[0]
818 summary, lineNumber = self.__getSummaryLine(docstringContext) 818 summary, lineNumber = self.__getSummaryLine(docstringContext)
819 if functionName + "(" in summary.replace(" ", ""): 819 if functionName + "(" in summary.replace(" ", "") and \
820 not functionName + "()" in summary.replace(" ", ""):
821 # report only, if it is not an abbreviated form (i.e. function() )
820 self.__error(docstringContext.start() + lineNumber, 0, "D133") 822 self.__error(docstringContext.start() + lineNumber, 0, "D133")
821 823
822 def __checkReturnType(self, docstringContext, context): 824 def __checkReturnType(self, docstringContext, context):
823 """ 825 """
824 Private method to check, that docstrings mention the return value type. 826 Private method to check, that docstrings mention the return value type.
954 """ 956 """
955 if docstringContext is None: 957 if docstringContext is None:
956 return 958 return
957 959
958 lines = docstringContext.source() 960 lines = docstringContext.source()
959 if lines[0].strip().strip('ru"'): 961 if lines[0].strip().strip('ru"\''):
960 self.__error(docstringContext.start(), 0, "D221") 962 self.__error(docstringContext.start(), 0, "D221")
961 if lines[-1].strip().strip('"'): 963 if lines[-1].strip().strip('"\''):
962 self.__error(docstringContext.end(), 0, "D222") 964 self.__error(docstringContext.end(), 0, "D222")
963 965
964 def __checkEricEndsWithPeriod(self, docstringContext, context): 966 def __checkEricEndsWithPeriod(self, docstringContext, context):
965 """ 967 """
966 Private method to check, that docstring summaries end with a period. 968 Private method to check, that docstring summaries end with a period.

eric ide

mercurial