Mercurial > public > mercurial-scm > hg-stable
diff contrib/check-code.py @ 19501:725507cd5216 stable
check-code: add a check for the next() builtin, which was new in 2.6
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Thu, 25 Jul 2013 10:44:51 -0400 |
parents | 3119dc155ac2 |
children | cf6b086d64cc |
line wrap: on
line diff
--- a/contrib/check-code.py Thu Jul 25 10:42:36 2013 -0400 +++ b/contrib/check-code.py Thu Jul 25 10:44:51 2013 -0400 @@ -173,6 +173,8 @@ (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Python 2.4'), + (r'(?<!def)(\s+|^|\()next\(.+\)', + 'no next(foo) in Python 2.4 and 2.5, use foo.next() instead'), (r'(\s+)try:\n((?:\n|\1\s.*\n)*?)\1\s*yield\b.*?' r'((?:\n|\1\s.*\n)+?)\1finally:', 'no yield inside try/finally in Python 2.4'),