Plugins/CheckerPlugins/Pep8/Pep257Checker.py

changeset 2948
ea04689ee599
parent 2945
0005e6314aea
child 2949
e8f41288a688
equal deleted inserted replaced
2947:bd95f61c4f96 2948:ea04689ee599
936 if docstringContext is None: 936 if docstringContext is None:
937 return 937 return
938 938
939 functionName = context.source()[0].lstrip().split()[1].split("(")[0] 939 functionName = context.source()[0].lstrip().split()[1].split("(")[0]
940 summary, lineNumber = self.__getSummaryLine(docstringContext) 940 summary, lineNumber = self.__getSummaryLine(docstringContext)
941 if functionName + "(" in summary.replace(" ", ""): 941 if functionName + "(" in summary.replace(" ", "") and \
942 not functionName + "()" in summary.replace(" ", ""):
943 # report only, if it is not an abbreviated form (i.e. function() )
942 self.__error(docstringContext.start() + lineNumber, 0, "D133") 944 self.__error(docstringContext.start() + lineNumber, 0, "D133")
943 945
944 def __checkReturnType(self, docstringContext, context): 946 def __checkReturnType(self, docstringContext, context):
945 """ 947 """
946 Private method to check, that docstrings mention the return value type. 948 Private method to check, that docstrings mention the return value type.
1076 """ 1078 """
1077 if docstringContext is None: 1079 if docstringContext is None:
1078 return 1080 return
1079 1081
1080 lines = docstringContext.source() 1082 lines = docstringContext.source()
1081 if lines[0].strip().strip('ru"'): 1083 if lines[0].strip().strip('ru"\''):
1082 self.__error(docstringContext.start(), 0, "D221") 1084 self.__error(docstringContext.start(), 0, "D221")
1083 if lines[-1].strip().strip('"'): 1085 if lines[-1].strip().strip('"\''):
1084 self.__error(docstringContext.end(), 0, "D222") 1086 self.__error(docstringContext.end(), 0, "D222")
1085 1087
1086 def __checkEricEndsWithPeriod(self, docstringContext, context): 1088 def __checkEricEndsWithPeriod(self, docstringContext, context):
1087 """ 1089 """
1088 Private method to check, that docstring summaries end with a period. 1090 Private method to check, that docstring summaries end with a period.

eric ide

mercurial