##// END OF EJS Templates
test-pyflake: improve sorting algorithm
timeless -
r14173:419539ea default
parent child Browse files
Show More
@@ -4,9 +4,24 b''
4
4
5 import sys, re
5 import sys, re
6
6
7 def makekey(message):
8 # "path/file:line: message"
9 match = re.search(r"(line \d+)", message)
10 line = ''
11 if match:
12 line = match.group(0)
13 message = re.sub(r"(line \d+)", '', message)
14 return re.sub(r"([^:]*):([^:]+):([^']*)('[^']*')(.*)$",
15 r'\3:\5:\4:\1:\2:' + line,
16 message)
17
18 lines = []
7 for line in sys.stdin:
19 for line in sys.stdin:
8 # We whitelist tests
20 # We whitelist tests
9 if not re.search("imported but unused", line):
21 if not re.search("imported but unused", line):
10 continue
22 continue
23 lines.append(line)
24
25 for line in sorted(lines, key = makekey):
11 sys.stdout.write(line)
26 sys.stdout.write(line)
12 print
27 print
@@ -1,11 +1,11 b''
1 $ "$TESTDIR/hghave" pyflakes || exit 80
1 $ "$TESTDIR/hghave" pyflakes || exit 80
2 $ cd $(dirname $TESTDIR)
2 $ cd $(dirname $TESTDIR)
3 $ pyflakes mercurial hgext 2>&1 | sort | $TESTDIR/filterpyflakes.py
3 $ pyflakes mercurial hgext 2>&1 | $TESTDIR/filterpyflakes.py
4 mercurial/hgweb/server.py:*: 'activeCount' imported but unused (glob)
4 mercurial/commands.py:*: 'base85' imported but unused (glob)
5 mercurial/commands.py:*: 'base85' imported but unused (glob)
5 mercurial/commands.py:*: 'bdiff' imported but unused (glob)
6 mercurial/commands.py:*: 'bdiff' imported but unused (glob)
6 mercurial/commands.py:*: 'mpatch' imported but unused (glob)
7 mercurial/commands.py:*: 'mpatch' imported but unused (glob)
7 mercurial/commands.py:*: 'osutil' imported but unused (glob)
8 mercurial/commands.py:*: 'osutil' imported but unused (glob)
8 mercurial/hgweb/server.py:*: 'activeCount' imported but unused (glob)
9 mercurial/revlog.py:*: 'short' imported but unused (glob)
9 mercurial/revlog.py:*: 'short' imported but unused (glob)
10
10
11
11
General Comments 0
You need to be logged in to leave comments. Login now