Show More
@@ -29,13 +29,16 b' lines = []' | |||
|
29 | 29 | for line in sys.stdin: |
|
30 | 30 | # We whitelist tests (see more messages in pyflakes.messages) |
|
31 | 31 | pats = [ |
|
32 | r"imported but unused", | |
|
33 | r"local variable '.*' is assigned to but never used", | |
|
34 | r"unable to detect undefined names", | |
|
35 | r"undefined name '.*'", | |
|
32 | (r"imported but unused", None), | |
|
33 | (r"local variable '.*' is assigned to but never used", None), | |
|
34 | (r"unable to detect undefined names", None), | |
|
36 | 35 | ] |
|
37 | for msgtype, pat in enumerate(pats): | |
|
38 | if re.search(pat, line): | |
|
36 | if sys.version_info >= (2, 7): | |
|
37 | pats.append((r"undefined name '.*'", None)) | |
|
38 | else: | |
|
39 | pats.append((r"undefined name '.*'", r"undefined name 'memoryview'")) | |
|
40 | for msgtype, (pat, excl) in enumerate(pats): | |
|
41 | if re.search(pat, line) and (not excl or not re.search(excl, line)): | |
|
39 | 42 | break # pattern matches |
|
40 | 43 | else: |
|
41 | 44 | continue # no pattern matched, next line |
@@ -50,3 +53,7 b' for line in sys.stdin:' | |||
|
50 | 53 | for msgtype, line in sorted(lines, key=makekey): |
|
51 | 54 | sys.stdout.write(line) |
|
52 | 55 | |
|
56 | ||
|
57 | # self test of "undefined name" detection for other than 'memoryview' | |
|
58 | if False: | |
|
59 | print undefinedname |
@@ -17,5 +17,6 b' run pyflakes on all tracked files ending' | |||
|
17 | 17 | tests/hghave.py:*: 'pygments' imported but unused (glob) |
|
18 | 18 | tests/hghave.py:*: 'ssl' imported but unused (glob) |
|
19 | 19 | contrib/win32/hgwebdir_wsgi.py:93: 'from isapi.install import *' used; unable to detect undefined names (glob) |
|
20 | tests/filterpyflakes.py:59: undefined name 'undefinedname' | |
|
20 | 21 | |
|
21 | 22 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now