eric7/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py

branch
eric7
changeset 9182
bc72e2fc0d8e
parent 9179
9ae7ca51e347
equal deleted inserted replaced
9181:809709f6f1d5 9182:bc72e2fc0d8e
209 (self.__checkEndsWithPeriod, ("D131",)), 209 (self.__checkEndsWithPeriod, ("D131",)),
210 (self.__checkBlankAfterSummary, ("D144",)), 210 (self.__checkBlankAfterSummary, ("D144",)),
211 (self.__checkBlankAfterLastParagraph, ("D145",)), 211 (self.__checkBlankAfterLastParagraph, ("D145",)),
212 ], 212 ],
213 } 213 }
214 elif self.__docType == "eric": 214 elif self.__docType in ("eric", "eric_black"):
215 checkersWithCodes = { 215 checkersWithCodes = {
216 "moduleDocstring": [ 216 "moduleDocstring": [
217 (self.__checkModulesDocstrings, ("D101", "D201")), 217 (self.__checkModulesDocstrings, ("D101", "D201")),
218 ], 218 ],
219 "functionDocstring": [ 219 "functionDocstring": [
1333 return 1333 return
1334 1334
1335 if isClassContext: 1335 if isClassContext:
1336 if not contextLines[start - 1].strip(): 1336 if not contextLines[start - 1].strip():
1337 self.__error(docstringContext.start(), 0, "D242") 1337 self.__error(docstringContext.start(), 0, "D242")
1338 if not contextLines[end + 1].strip(): 1338 if not contextLines[end + 1].strip() and self.__docType == "eric":
1339 self.__error(docstringContext.end(), 0, "D243") 1339 self.__error(docstringContext.end(), 0, "D243")
1340 elif contextLines[end + 1].strip() and self.__docType == "eric_black":
1341 self.__error(docstringContext.end(), 0, "D143")
1340 else: 1342 else:
1341 if not contextLines[start - 1].strip(): 1343 if not contextLines[start - 1].strip():
1342 self.__error(docstringContext.start(), 0, "D244") 1344 self.__error(docstringContext.start(), 0, "D244")
1343 if not contextLines[end + 1].strip(): 1345 if not contextLines[end + 1].strip():
1346 if (
1347 self.__docType == "eric_black" and
1348 len(contextLines) > end + 2 and
1349 contextLines[end + 2].strip().startswith("def ")
1350 ):
1351 return
1352
1344 self.__error(docstringContext.end(), 0, "D245") 1353 self.__error(docstringContext.end(), 0, "D245")
1345 1354
1346 def __checkEricNBlankAfterLastParagraph(self, docstringContext, context): 1355 def __checkEricNBlankAfterLastParagraph(self, docstringContext, context):
1347 """ 1356 """
1348 Private method to check, that the last paragraph of docstrings is 1357 Private method to check, that the last paragraph of docstrings is

eric ide

mercurial