Show More
@@ -29,13 +29,16 b' lines = []' | |||||
29 | for line in sys.stdin: |
|
29 | for line in sys.stdin: | |
30 | # We whitelist tests (see more messages in pyflakes.messages) |
|
30 | # We whitelist tests (see more messages in pyflakes.messages) | |
31 | pats = [ |
|
31 | pats = [ | |
32 | r"imported but unused", |
|
32 | (r"imported but unused", None), | |
33 | r"local variable '.*' is assigned to but never used", |
|
33 | (r"local variable '.*' is assigned to but never used", None), | |
34 | r"unable to detect undefined names", |
|
34 | (r"unable to detect undefined names", None), | |
35 | r"undefined name '.*'", |
|
|||
36 | ] |
|
35 | ] | |
37 | for msgtype, pat in enumerate(pats): |
|
36 | if sys.version_info >= (2, 7): | |
38 | if re.search(pat, line): |
|
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 | break # pattern matches |
|
42 | break # pattern matches | |
40 | else: |
|
43 | else: | |
41 | continue # no pattern matched, next line |
|
44 | continue # no pattern matched, next line | |
@@ -50,3 +53,7 b' for line in sys.stdin:' | |||||
50 | for msgtype, line in sorted(lines, key=makekey): |
|
53 | for msgtype, line in sorted(lines, key=makekey): | |
51 | sys.stdout.write(line) |
|
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 | tests/hghave.py:*: 'pygments' imported but unused (glob) |
|
17 | tests/hghave.py:*: 'pygments' imported but unused (glob) | |
18 | tests/hghave.py:*: 'ssl' imported but unused (glob) |
|
18 | tests/hghave.py:*: 'ssl' imported but unused (glob) | |
19 | contrib/win32/hgwebdir_wsgi.py:93: 'from isapi.install import *' used; unable to detect undefined names (glob) |
|
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 | #endif |
|
22 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now