Show More
@@ -149,6 +149,7 b' pypats = [' | |||||
149 | (r'raise Exception', "don't raise generic exceptions"), |
|
149 | (r'raise Exception', "don't raise generic exceptions"), | |
150 | (r'ui\.(status|progress|write|note|warn)\([\'\"]x', |
|
150 | (r'ui\.(status|progress|write|note|warn)\([\'\"]x', | |
151 | "warning: unwrapped ui message"), |
|
151 | "warning: unwrapped ui message"), | |
|
152 | (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"), | |||
152 | ] |
|
153 | ] | |
153 |
|
154 | |||
154 | pyfilters = [ |
|
155 | pyfilters = [ |
@@ -52,3 +52,44 b'' | |||||
52 | > y = format(x) |
|
52 | > y = format(x) | |
53 | any/all/format not available in Python 2.4 |
|
53 | any/all/format not available in Python 2.4 | |
54 | [1] |
|
54 | [1] | |
|
55 | ||||
|
56 | $ cat > is-op.py <<EOF | |||
|
57 | > # is-operator comparing number or string literal | |||
|
58 | > x = None | |||
|
59 | > y = x is 'foo' | |||
|
60 | > y = x is "foo" | |||
|
61 | > y = x is 5346 | |||
|
62 | > y = x is -6 | |||
|
63 | > y = x is not 'foo' | |||
|
64 | > y = x is not "foo" | |||
|
65 | > y = x is not 5346 | |||
|
66 | > y = x is not -6 | |||
|
67 | > EOF | |||
|
68 | ||||
|
69 | $ "$check_code" ./is-op.py | |||
|
70 | ./is-op.py:3: | |||
|
71 | > y = x is 'foo' | |||
|
72 | object comparison with literal | |||
|
73 | ./is-op.py:4: | |||
|
74 | > y = x is "foo" | |||
|
75 | object comparison with literal | |||
|
76 | ./is-op.py:5: | |||
|
77 | > y = x is 5346 | |||
|
78 | object comparison with literal | |||
|
79 | ./is-op.py:6: | |||
|
80 | > y = x is -6 | |||
|
81 | object comparison with literal | |||
|
82 | ./is-op.py:7: | |||
|
83 | > y = x is not 'foo' | |||
|
84 | object comparison with literal | |||
|
85 | ./is-op.py:8: | |||
|
86 | > y = x is not "foo" | |||
|
87 | object comparison with literal | |||
|
88 | ./is-op.py:9: | |||
|
89 | > y = x is not 5346 | |||
|
90 | object comparison with literal | |||
|
91 | ./is-op.py:10: | |||
|
92 | > y = x is not -6 | |||
|
93 | object comparison with literal | |||
|
94 | [1] | |||
|
95 |
General Comments 0
You need to be logged in to leave comments.
Login now