Plugins/CheckerPlugins/Pep8/Pep257Checker.py

changeset 2944
dcca9f5c701d
parent 2937
de26bc76d6ee
child 2945
0005e6314aea
equal deleted inserted replaced
2940:e9348df06994 2944:dcca9f5c701d
1008 1008
1009 while cti < len(contextLines) and \ 1009 while cti < len(contextLines) and \
1010 not contextLines[cti].strip().endswith(('"""', "'''")): 1010 not contextLines[cti].strip().endswith(('"""', "'''")):
1011 cti += 1 1011 cti += 1
1012 end = cti 1012 end = cti
1013 if cti == len(contextLines): 1013 if cti >= len(contextLines) - 1:
1014 return 1014 return
1015 1015
1016 if contextLines[start - 1].strip(): 1016 if contextLines[start - 1].strip():
1017 self.__error(docstringContext.start(), 0, "D142") 1017 self.__error(docstringContext.start(), 0, "D142")
1018 if contextLines[end + 1].strip(): 1018 if contextLines[end + 1].strip():
1154 # extract @param and @keyparam from docstring 1154 # extract @param and @keyparam from docstring
1155 args = [] 1155 args = []
1156 kwargs = [] 1156 kwargs = []
1157 for line in docstringContext.source(): 1157 for line in docstringContext.source():
1158 if line.strip().startswith(("@param", "@keyparam")): 1158 if line.strip().startswith(("@param", "@keyparam")):
1159 at, name, _ = line.strip().split(None, 2) 1159 at, name = line.strip().split(None, 2)[:2]
1160 if at == "@keyparam": 1160 if at == "@keyparam":
1161 kwargs.append(name) 1161 kwargs.append(name)
1162 args.append(name) 1162 args.append(name)
1163 1163
1164 # do the checks 1164 # do the checks
1220 1220
1221 while cti < len(contextLines) and \ 1221 while cti < len(contextLines) and \
1222 not contextLines[cti].strip().endswith(('"""', "'''")): 1222 not contextLines[cti].strip().endswith(('"""', "'''")):
1223 cti += 1 1223 cti += 1
1224 end = cti 1224 end = cti
1225 if cti == len(contextLines): 1225 if cti >= len(contextLines) - 1:
1226 return 1226 return
1227 1227
1228 if isClassContext: 1228 if isClassContext:
1229 if not contextLines[start - 1].strip(): 1229 if not contextLines[start - 1].strip():
1230 self.__error(docstringContext.start(), 0, "D242") 1230 self.__error(docstringContext.start(), 0, "D242")

eric ide

mercurial