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

changeset 7998
cd41c844862f
parent 7987
e8eb8370ea94
child 8043
0acf98cd089a
child 8166
bd5cd5858503
diff -r 2ca23396c25c -r cd41c844862f eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py	Fri Jan 22 14:14:15 2021 +0100
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py	Fri Jan 22 16:48:43 2021 +0100
@@ -128,7 +128,7 @@
         "D130", "D131", "D132", "D133", "D134",
         "D141", "D142", "D143", "D144", "D145",
         
-        "D203", "D205", "D206",
+        "D201", "D202.1", "D202.2", "D203", "D205", "D206",
         "D221", "D222",
         "D231", "D232", "D234r", "D234y", "D235r", "D235y", "D236", "D237",
         "D238", "D239",
@@ -216,7 +216,7 @@
         elif self.__docType == "eric":
             checkersWithCodes = {
                 "moduleDocstring": [
-                    (self.__checkModulesDocstrings, ("D101",)),
+                    (self.__checkModulesDocstrings, ("D101", "D201")),
                 ],
                 "functionDocstring": [
                 ],
@@ -230,7 +230,8 @@
                     (self.__checkEricSummary, ("D232")),
                 ],
                 "defDocstring": [
-                    (self.__checkFunctionDocstring, ("D102", "D203")),
+                    (self.__checkFunctionDocstring,
+                     ("D102", "D202.1", "D202.2", "D203")),
                     (self.__checkImperativeMood, ("D132",)),
                     (self.__checkNoSignature, ("D133",)),
                     (self.__checkEricReturn, ("D234r", "D235r")),
@@ -695,13 +696,20 @@
                 not docstring.strip('\'"')):
             self.__error(context.start(), 0, code)
         
-        if (
-            self.__docType == "eric" and
-            docstring.strip('\'"').strip() ==
-            "Function documentation goes here."
-        ):
-            self.__error(docstringContext.end(), 0, "D202")
-            return
+        if self.__docType == "eric":
+            if (
+                docstring.strip('\'"').strip() ==
+                "Function documentation goes here."
+            ):
+                self.__error(docstringContext.end(), 0, "D202.1")
+                return
+            
+            if (
+                "DESCRIPTION" in docstring or
+                "TYPE" in docstring
+            ):
+                self.__error(docstringContext.end(), 0, "D202.2")
+                return
     
     def __checkClassDocstring(self, docstringContext, context):
         """

eric ide

mercurial