mailr11381 - /1.3/scripts/code_validator


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 28, 2010 - 11:13:
Author: bugman
Date: Wed Jul 28 11:13:46 2010
New Revision: 11381

URL: http://svn.gna.org/viewcvs/relax?rev=11381&view=rev
Log:
Removed the docstring length check from the code validator script and changed 
a printout.

The docstring length is only 100 characters in the user functions.  For all 
other functions, no
length is enforced.


Modified:
    1.3/scripts/code_validator

Modified: 1.3/scripts/code_validator
URL: 
http://svn.gna.org/viewcvs/relax/1.3/scripts/code_validator?rev=11381&r1=11380&r2=11381&view=diff
==============================================================================
--- 1.3/scripts/code_validator (original)
+++ 1.3/scripts/code_validator Wed Jul 28 11:13:46 2010
@@ -58,9 +58,6 @@
         # Empty line after docstring.
         self.docstring_clearance()
 
-        # Docstring length.
-        self.docstring_length()
-
 
         # Variable, function, and class names.
         ######################################
@@ -173,7 +170,7 @@
         """Test for proper class naming."""
 
         # Heading.
-        sys.stdout.write(self.indent + "Class naming (must start with a 
capital).\n")
+        sys.stdout.write(self.indent + "Class naming (should start with a 
capital).\n")
 
         # Flags.
         ok = 1
@@ -461,72 +458,6 @@
         self.terminate(ok)
 
 
-    def docstring_length(self):
-        """Test that the docstring is less than 100 char long."""
-
-        # Heading.
-        sys.stdout.write(self.indent + "Docstring length.  Should be less 
than 100 characters including all leading whitespace (equations can be 
longer).\n")
-
-        # Flags.
-        ok = 1
-
-        # Loop over the file.
-        for i in xrange(len(self.lines)):
-            # Flags.
-            too_long = 0
-
-            # Find the functions.
-            if search("^ *def ", self.lines[i]):
-                # Skip functions without docstrings!
-                if not search("^ *\"\"\"", self.lines[i+1]) and not 
search("^ *\'\'\'", self.lines[i+1]):
-                    continue
-
-                # Split the docstring line.
-                if search("^ *\"\"\"", self.lines[i+1]):
-                    row = split(self.lines[i+1], "\"\"\"")
-                else:
-                    row = split(self.lines[i+1], "\'\'\'")
-
-                # Loop over the docstring.
-                j = 0
-                while 1:
-                    # Single line docstring.
-                    if len(row) == 3:
-                        # Test the length of the line.
-                        if len(row[0]) + 3 + len(row[1]) > 101:
-                            too_long = 1
-                        break
-
-                    # Test the length of the line.
-                    if len(self.lines[i+1+j]) > 101:
-                        too_long = 1
-                        break
-
-                    # Increment the line counter.
-                    j = j + 1
-
-                    # End of the docstring.
-                    if search("\"\"\"", self.lines[i+1+j]) or 
search("\'\'\'", self.lines[i+1+j]):
-                        break
-
-                # Docstring is ok.
-                if not too_long:
-                    continue
-
-                # Initial print out.
-                if ok:
-                    sys.stdout.write(self.indent + "    Line num: ")
-                    sys.stdout.write(`i+1+j+2`)
-                    ok = 0
-
-                # Print the line number.
-                else:
-                    sys.stdout.write(", " + `i+1+j+2`)
-
-        # Termination.
-        self.terminate(ok)
-
-
     def function_args(self):
         """Test for proper function argment spacing."""
 




Related Messages


Powered by MHonArc, Updated Wed Jul 28 11:40:02 2010