annotate unixSoft/bin/epylint @ 325:64e73453e43f

xmonad: Pull apart custom layout into something readable This change doesn't affect any behavior, but it does document the custom layout by naming function parameters. Hopefully, this will make things easier to fix the next time the XMonad developers break us.
author Lucas Bergman <lucas@bergmans.us>
date Tue, 11 Mar 2014 12:49:05 -0500
parents 7f67cf332537
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
93
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 import re
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 import sys
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 from subprocess import Popen, PIPE
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 p = Popen("pylint -f parseable -r n --disable-msg-cat=C,R %s" %
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 sys.argv[1], shell = True, stdout = PIPE).stdout
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 for line in p.readlines():
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11 match = re.search("\\[([WE])(, (.+?))?\\]", line)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 if match:
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13 kind = match.group(1)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 func = match.group(3)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15 if kind == "W":
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 msg = "Warning"
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 else:
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18 msg = "Error"
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 if func:
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 line = re.sub("\\[([WE])(, (.+?))?\\]",
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 "%s (%s):" % (msg, func), line)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 else:
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 line = re.sub("\\[([WE])?\\]", "%s:" % msg, line)
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 print line,
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26
7f67cf332537 Started using pylint.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 p.close()