UtilitiesPython2/Pep8Checker.py

changeset 2929
28ab0bc63d69
parent 2917
fe82710d02cb
child 2958
ed0a8d4304a8
--- a/UtilitiesPython2/Pep8Checker.py	Sun Sep 22 19:47:04 2013 +0200
+++ b/UtilitiesPython2/Pep8Checker.py	Mon Sep 23 19:32:25 2013 +0200
@@ -62,6 +62,7 @@
     filename = ""
     max_line_length = 79
     hang_closing = False
+    docType = "pep257"
     
     if "-f" not in sys.argv:
         print "ERROR"
@@ -69,7 +70,7 @@
         print "No file name given."
     else:
         try:
-            optlist, args = getopt.getopt(sys.argv[1:], "f:hi:m:rs:")
+            optlist, args = getopt.getopt(sys.argv[1:], "d:f:hi:m:rs:")
         except getopt.GetoptError:
             print "ERROR"
             print ""
@@ -93,6 +94,9 @@
                     pass
             elif opt == "-h":
                 hang_closing = True
+            elif opt == "-d":
+                if arg in ("pep257", "eric"):
+                    docType = arg
         
         try:
             source = readEncodedFile(filename)[0]
@@ -128,8 +132,8 @@
         
         # check PEP-257
         pep257Checker = Pep257Checker(
-            source, file, select, ignore, [], repeat,
-            maxLineLength=max_line_length)
+            source, filename, select, ignore, [], repeat,
+            maxLineLength=max_line_length, docType=docType)
         pep257Checker.run()
         
         
@@ -148,6 +152,7 @@
                 for a in args:
                     print a
             print "PEP8_STATISTICS"
+            # TODO: add statistics for D
             for key in report.counters:
                 if key.startswith(("E", "N", "W")):
                     print key, report.counters[key]

eric ide

mercurial