# HG changeset patch # User Matt Mackall # Date 1320878214 21600 # Node ID 1470f8b0069428ee587ec9255af58bcca6267638 # Parent abcaaf51d56805d518f713bc1923dbc5e29a8ebe check-code: enable camelcase check, fix up problems diff -r abcaaf51d568 -r 1470f8b00694 contrib/check-code.py --- a/contrib/check-code.py Mon Nov 07 13:20:22 2011 +0100 +++ b/contrib/check-code.py Wed Nov 09 16:36:54 2011 -0600 @@ -131,7 +131,8 @@ (r'[^\n]\Z', "no trailing newline"), (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"), -# (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"), + (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ', + "don't use camelcase in identifiers"), (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', "linebreak after :"), (r'class\s[^( \n]+:', "old-style class, use class foo(object)"), diff -r abcaaf51d568 -r 1470f8b00694 hgext/convert/darcs.py --- a/hgext/convert/darcs.py Mon Nov 07 13:20:22 2011 +0100 +++ b/hgext/convert/darcs.py Wed Nov 09 16:36:54 2011 -0600 @@ -24,7 +24,7 @@ try: from elementtree.ElementTree import ElementTree, XMLParser except ImportError: - ElementTree = None + pass class darcs_source(converter_source, commandline): def __init__(self, ui, path, rev=None): @@ -42,7 +42,7 @@ raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') % version) - if ElementTree is None: + if "ElementTree" not in globals(): raise util.Abort(_("Python ElementTree module is not available")) self.path = os.path.realpath(path)