Some more tweaks to the doc style checker.

Sat, 28 Sep 2013 16:46:46 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 28 Sep 2013 16:46:46 +0200
changeset 2948
ea04689ee599
parent 2947
bd95f61c4f96
child 2949
e8f41288a688

Some more tweaks to the doc style checker.

Plugins/CheckerPlugins/Pep8/Pep257Checker.py file | annotate | diff | comparison | revisions
UtilitiesPython2/Pep257CheckerPy2.py file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/Pep8/Pep257Checker.py	Sat Sep 28 16:39:31 2013 +0200
+++ b/Plugins/CheckerPlugins/Pep8/Pep257Checker.py	Sat Sep 28 16:46:46 2013 +0200
@@ -938,7 +938,9 @@
         
         functionName = context.source()[0].lstrip().split()[1].split("(")[0]
         summary, lineNumber = self.__getSummaryLine(docstringContext)
-        if functionName + "(" in summary.replace(" ", ""):
+        if functionName + "(" in summary.replace(" ", "") and \
+                not functionName + "()" in summary.replace(" ", ""):
+            # report only, if it is not an abbreviated form (i.e. function() )
             self.__error(docstringContext.start() + lineNumber, 0, "D133")
     
     def __checkReturnType(self, docstringContext, context):
@@ -1078,9 +1080,9 @@
             return
         
         lines = docstringContext.source()
-        if lines[0].strip().strip('ru"'):
+        if lines[0].strip().strip('ru"\''):
             self.__error(docstringContext.start(), 0, "D221")
-        if lines[-1].strip().strip('"'):
+        if lines[-1].strip().strip('"\''):
             self.__error(docstringContext.end(), 0, "D222")
     
     def __checkEricEndsWithPeriod(self, docstringContext, context):
--- a/UtilitiesPython2/Pep257CheckerPy2.py	Sat Sep 28 16:39:31 2013 +0200
+++ b/UtilitiesPython2/Pep257CheckerPy2.py	Sat Sep 28 16:46:46 2013 +0200
@@ -816,7 +816,9 @@
         
         functionName = context.source()[0].lstrip().split()[1].split("(")[0]
         summary, lineNumber = self.__getSummaryLine(docstringContext)
-        if functionName + "(" in summary.replace(" ", ""):
+        if functionName + "(" in summary.replace(" ", "") and \
+                not functionName + "()" in summary.replace(" ", ""):
+            # report only, if it is not an abbreviated form (i.e. function() )
             self.__error(docstringContext.start() + lineNumber, 0, "D133")
     
     def __checkReturnType(self, docstringContext, context):
@@ -956,9 +958,9 @@
             return
         
         lines = docstringContext.source()
-        if lines[0].strip().strip('ru"'):
+        if lines[0].strip().strip('ru"\''):
             self.__error(docstringContext.start(), 0, "D221")
-        if lines[-1].strip().strip('"'):
+        if lines[-1].strip().strip('"\''):
             self.__error(docstringContext.end(), 0, "D222")
     
     def __checkEricEndsWithPeriod(self, docstringContext, context):

eric ide

mercurial