diff unixSoft/bin/epylint @ 93:7f67cf332537

Started using pylint.
author Augie Fackler <durin42@gmail.com>
date Wed, 22 Apr 2009 11:10:06 -0500
parents
children
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/unixSoft/bin/epylint
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+import re
+import sys
+
+from subprocess import Popen, PIPE
+
+p = Popen("pylint -f parseable -r n --disable-msg-cat=C,R %s" %
+          sys.argv[1], shell = True, stdout = PIPE).stdout
+
+for line in p.readlines():
+    match = re.search("\\[([WE])(, (.+?))?\\]", line)
+    if match:
+        kind = match.group(1)
+        func = match.group(3)
+        if kind == "W":
+            msg = "Warning"
+        else:
+            msg = "Error"
+
+        if func:
+            line = re.sub("\\[([WE])(, (.+?))?\\]",
+                          "%s (%s):" % (msg, func), line)
+        else:
+            line = re.sub("\\[([WE])?\\]", "%s:" % msg, line)
+    print line,
+
+    p.close()