annotate unixSoft/bin/epylint @ 378:20e47bc8eea9

hgrc: disable hg-git and hgsubversion It hasn't been common for me to use either of these extensions for some time, so just drop both of them from the main hgrc. Instead I'll enable them as-needed in individual repositories.
author Augie Fackler <durin42@gmail.com>
date Thu, 09 Jun 2011 20:20:04 -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()