check-code: enable camelcase check, fix up problems
authorMatt Mackall <mpm@selenic.com>
Wed, 09 Nov 2011 16:36:54 -0600
changeset 15457 1470f8b00694
parent 15456 abcaaf51d568
child 15458 c3a6ec304055
check-code: enable camelcase check, fix up problems
contrib/check-code.py
hgext/convert/darcs.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)"),
--- 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)