diff options
-rwxr-xr-x | bin/epylint | 29 | ||||
-rw-r--r-- | bin/epylint.bat | 16 | ||||
-rwxr-xr-x | epylint.py | 25 |
3 files changed, 43 insertions, 27 deletions
diff --git a/bin/epylint b/bin/epylint index a133c43..4aad657 100755 --- a/bin/epylint +++ b/bin/epylint @@ -1,28 +1,3 @@ #!/usr/bin/env python - -import re -import sys - -from popen2 import popen3 - -p, _in, _err = popen3("pylint -f parseable -r n --disable-msg-cat=C,R,I %s" % sys.argv[1]) - -for line in p: - 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() +from pylint import epylint +epylint.Run() diff --git a/bin/epylint.bat b/bin/epylint.bat new file mode 100644 index 0000000..a506782 --- /dev/null +++ b/bin/epylint.bat @@ -0,0 +1,16 @@ +@echo off +rem = """-*-Python-*- script +rem -------------------- DOS section -------------------- +rem You could set PYTHONPATH or TK environment variables here +python -x "%~f0" %* +goto exit + +""" +# -------------------- Python section -------------------- +from pylint import epylint +epylint.Run() + + +DosExitLabel = """ +:exit +rem """ diff --git a/epylint.py b/epylint.py new file mode 100755 index 0000000..3493a82 --- /dev/null +++ b/epylint.py @@ -0,0 +1,25 @@ +"""simple pylint wrapper for emacs intraction""" + +import re +import sys + +from popen2 import popen3 + +def Run(): + p, _in, _err = popen3("pylint -f parseable -r n --disable-msg-cat=C,R,I %s" + % sys.argv[1]) + for line in p: + match = re.search("\\[([WE])(, (.+?))?\\]", line) + if match: + if match.group(1) == "W": + msg = "Warning" + else: + msg = "Error" + func = match.group(3) + if func: + line = re.sub("\\[([WE])(, (.+?))?\\]", + "%s (%s):" % (msg, func), line) + else: + line = re.sub("\\[([WE])?\\]", "%s:" % msg, line) + print line, + p.close() |