Show More
@@ -1,27 +1,31 | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | |
|
3 | 3 | # Filter output by pyflakes to control which warnings we check |
|
4 | 4 | |
|
5 | 5 | import sys, re |
|
6 | 6 | |
|
7 | 7 | def makekey(message): |
|
8 | 8 | # "path/file:line: message" |
|
9 | 9 | match = re.search(r"(line \d+)", message) |
|
10 | 10 | line = '' |
|
11 | 11 | if match: |
|
12 | 12 | line = match.group(0) |
|
13 | 13 | message = re.sub(r"(line \d+)", '', message) |
|
14 | 14 | return re.sub(r"([^:]*):([^:]+):([^']*)('[^']*')(.*)$", |
|
15 | 15 | r'\3:\5:\4:\1:\2:' + line, |
|
16 | 16 | message) |
|
17 | 17 | |
|
18 | 18 | lines = [] |
|
19 | 19 | for line in sys.stdin: |
|
20 | 20 | # We whitelist tests |
|
21 | if not re.search("imported but unused", line): | |
|
21 | pats = [ | |
|
22 | r"imported but unused", | |
|
23 | r"local variable '.*' is assigned to but never used", | |
|
24 | ] | |
|
25 | if not re.search('|'.join(pats), line): | |
|
22 | 26 | continue |
|
23 | 27 | lines.append(line) |
|
24 | 28 | |
|
25 | 29 | for line in sorted(lines, key = makekey): |
|
26 | 30 | sys.stdout.write(line) |
|
27 | 31 |
General Comments 0
You need to be logged in to leave comments.
Login now