summaryrefslogtreecommitdiff
path: root/bin/epylint
blob: d0f23bbf3807f98a2645f679f78156b6d6e5cdea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/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 %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()