Mercurial > public > mercurial-scm > hg-stable
comparison contrib/check-code.py @ 13031:3da456d0c885
code style: prefer 'is' and 'is not' tests with singletons
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Mon, 22 Nov 2010 18:15:58 +0100 |
parents | 53391819f195 |
children | 637627f31c74 |
comparison
equal
deleted
inserted
replaced
13030:8ea51e9e7031 | 13031:3da456d0c885 |
---|---|
148 "wrong whitespace around ="), | 148 "wrong whitespace around ="), |
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 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"), |
153 (r' [=!]=\s+(True|False|None)', | |
154 "comparison with singleton, use 'is' or 'is not' instead"), | |
153 ] | 155 ] |
154 | 156 |
155 pyfilters = [ | 157 pyfilters = [ |
156 (r"""(?msx)(?P<comment>\#.*?$)| | 158 (r"""(?msx)(?P<comment>\#.*?$)| |
157 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) | 159 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) |