[PATCH 2 of 2] checkcode: rename 'check-code.py' to Mercurial style 'checkcode'

Mads Kiilerich mads at kiilerich.com
Mon Jan 14 19:23:19 CST 2013


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1358212966 -3600
# Node ID 652bc126f86ca4ca2a753cf040586727df3a92bb
# Parent  9f036303309a2af199832165ba00b24b8a4df16f
checkcode: rename 'check-code.py' to Mercurial style 'checkcode'

The '-' is inconsistent with the general preference in Mercurial, and the '.py'
is just inconvenient and cause inconsistency when referring to the tool. It had
'-' in the name and could thus not be used as a Python module anyway.

diff --git a/contrib/check-code.py b/contrib/checkcode
rename from contrib/check-code.py
rename to contrib/checkcode
--- a/contrib/check-code.py
+++ b/contrib/checkcode
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# check-code - a style and portability checker for Mercurial
+# checkcode - a style and portability checker for Mercurial
 #
 # Copyright 2010 Matt Mackall <mpm at selenic.com>
 #
@@ -347,9 +347,9 @@ def checkfile(f, logfunc=_defaultlogger.
         fp = open(f)
         pre = post = fp.read()
         fp.close()
-        if "no-" + "check-code" in pre:
+        if "no-" + "checkcode" in pre:
             if debug:
-                print "Skipping %s for %s it has no- and check-code" % (
+                print "Skipping %s for %s it has no- and checkcode" % (
                        name, f)
             break
         for p, r in filters:
@@ -397,9 +397,9 @@ def checkfile(f, logfunc=_defaultlogger.
                     n += 1
                 l = prelines[n]
 
-                if "check-code" + "-ignore" in l:
+                if "checkcode" + "-ignore" in l:
                     if debug:
-                        print "Skipping %s for %s:%s (check-code -ignore)" % (
+                        print "Skipping %s for %s:%s (checkcode -ignore)" % (
                             name, f, n)
                     continue
                 elif ignore and re.search(ignore, l, re.MULTILINE):
diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -443,7 +443,7 @@ def demo(ui, repo, *args, **opts):
         if name.split('.', 1)[0].find('commit') > -1:
             repo.ui.setconfig('hooks', name, '')
     msg = _('hg keyword configuration and expansion example')
-    ui.note("hg ci -m '%s'\n" % msg) # check-code-ignore
+    ui.note("hg ci -m '%s'\n" % msg) # checkcode-ignore
     repo.commit(text=msg)
     ui.status(_('\n\tkeywords expanded\n'))
     ui.write(repo.wread(fn))
diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py
+++ b/hgext/zeroconf/Zeroconf.py
@@ -1577,4 +1577,4 @@ if __name__ == '__main__':
 	print "   Unregister done."
 	r.close()
 
-# no-check-code
+# no-checkcode
diff --git a/i18n/polib.py b/i18n/polib.py
--- a/i18n/polib.py
+++ b/i18n/polib.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# no-check-code
+# no-checkcode
 #
 # License: MIT (see LICENSE file provided)
 # vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
diff --git a/mercurial/httpclient/__init__.py b/mercurial/httpclient/__init__.py
--- a/mercurial/httpclient/__init__.py
+++ b/mercurial/httpclient/__init__.py
@@ -671,4 +671,4 @@ class HTTPStateError(httplib.HTTPExcepti
 # Forward this exception type from _readers since it needs to be part
 # of the public API.
 HTTPRemoteClosedError = _readers.HTTPRemoteClosedError
-# no-check-code
+# no-checkcode
diff --git a/mercurial/httpclient/_readers.py b/mercurial/httpclient/_readers.py
--- a/mercurial/httpclient/_readers.py
+++ b/mercurial/httpclient/_readers.py
@@ -192,4 +192,4 @@ class ChunkedReader(AbstractReader):
                 return
             self._done_chunks.append(data[block_start:block_start + amt])
             position = block_start + amt + len(self._eol)
-# no-check-code
+# no-checkcode
diff --git a/mercurial/httpclient/socketutil.py b/mercurial/httpclient/socketutil.py
--- a/mercurial/httpclient/socketutil.py
+++ b/mercurial/httpclient/socketutil.py
@@ -124,4 +124,4 @@ else:
 
 class CertificateValidationUnsupported(Exception):
     """Exception raised when cert validation is requested but unavailable."""
-# no-check-code
+# no-checkcode
diff --git a/tests/filterpyflakes.py b/tests/filterpyflakes.py
--- a/tests/filterpyflakes.py
+++ b/tests/filterpyflakes.py
@@ -29,7 +29,7 @@ for line in sys.stdin:
     f = open(os.path.join(os.path.dirname(os.path.dirname(__file__)), fn))
     data = f.read()
     f.close()
-    if 'no-check-code' in data:
+    if 'no-checkcode' in data:
         continue
     lines.append(line)
 
diff --git a/tests/test-check-code-hg.t b/tests/test-checkcode-hg.t
rename from tests/test-check-code-hg.t
rename to tests/test-checkcode-hg.t
--- a/tests/test-check-code-hg.t
+++ b/tests/test-checkcode-hg.t
@@ -1,4 +1,4 @@
-  $ check_code="$TESTDIR"/../contrib/check-code.py
+  $ checkcode="$TESTDIR"/../contrib/checkcode
   $ cd "$TESTDIR"/..
   $ if hg identify -q > /dev/null; then :
   > else
@@ -8,4 +8,4 @@
 
 New errors are not allowed. Warnings are strongly discouraged.
 
-  $ hg manifest | xargs "$check_code" --warnings --nolineno --per-file=0
+  $ hg manifest | xargs "$checkcode" --warnings --nolineno --per-file=0
diff --git a/tests/test-check-code.t b/tests/test-checkcode.t
rename from tests/test-check-code.t
rename to tests/test-checkcode.t
--- a/tests/test-check-code.t
+++ b/tests/test-checkcode.t
@@ -70,8 +70,8 @@
   > no_class = 1:
   >     pass
   > EOF
-  $ check_code="$TESTDIR"/../contrib/check-code.py
-  $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py ./classstyle.py
+  $ checkcode="$TESTDIR"/../contrib/checkcode
+  $ "$checkcode" ./wrong.py ./correct.py ./quote.py ./non-py24.py ./classstyle.py
   ./wrong.py:1:
    > def toto( arg1, arg2):
    gratuitous whitespace in () or []
@@ -114,7 +114,7 @@
   > foo <> bar
   > reduce(lambda a, b: a + b, [1, 2, 3, 4])
   > EOF
-  $ "$check_code" python3-compat.py
+  $ "$checkcode" python3-compat.py
   python3-compat.py:1:
    > foo <> bar
    <> operator is not available in Python 3+, use !=
@@ -136,7 +136,7 @@
   > y = x is not -6
   > EOF
 
-  $ "$check_code" ./is-op.py
+  $ "$checkcode" ./is-op.py
   ./is-op.py:3:
    > y = x is 'foo'
    object comparison with literal
@@ -166,7 +166,7 @@
   $ cat > warning.py <<EOF
   > except:
   > EOF
-  $ "$check_code" warning.py --warning --nolineno
+  $ "$checkcode" warning.py --warning --nolineno
   warning.py:0:
    > except:
    warning: naked except clause
@@ -177,7 +177,7 @@
   > # this next line is okay
   > raise SomeException(arg1, arg2)
   > EOF
-  $ "$check_code" raise-format.py
+  $ "$checkcode" raise-format.py
   raise-format.py:1:
    > raise SomeException, message
    don't use old-style two-argument raise, use Exception(message)
diff --git a/tests/test-hgrc.t b/tests/test-hgrc.t
--- a/tests/test-hgrc.t
+++ b/tests/test-hgrc.t
@@ -6,7 +6,7 @@ Use hgrc within $TESTTMP
   $ HGRCPATH=`pwd`/hgrc
   $ export HGRCPATH
 
-Use an alternate var for scribbling on hgrc to keep check-code from
+Use an alternate var for scribbling on hgrc to keep checkcode from
 complaining about the important settings we may be overwriting:
 
   $ HGRC=`pwd`/hgrc
diff --git a/tests/test-remove.t b/tests/test-remove.t
--- a/tests/test-remove.t
+++ b/tests/test-remove.t
@@ -1,6 +1,6 @@
   $ remove() {
   >     hg rm $@
-  >     echo "exit code: $?" # no-check-code
+  >     echo "exit code: $?" # no-checkcode
   >     hg st
   >     # do not use ls -R, which recurses in .hg subdirs on Mac OS X 10.5
   >     find . -name .hg -prune -o -type f -print | sort
diff --git a/tests/test-subrepo-paths.t b/tests/test-subrepo-paths.t
--- a/tests/test-subrepo-paths.t
+++ b/tests/test-subrepo-paths.t
@@ -17,7 +17,7 @@ hg debugsub with no remapping
 hg debugsub with remapping
 
   $ echo '[subpaths]' >> .hg/hgrc
-  $ printf 'http://example.net/lib(.*) = C:\\libs\\\\1-lib\\\n' >> .hg/hgrc # no-check-code
+  $ printf 'http://example.net/lib(.*) = C:\\libs\\\\1-lib\\\n' >> .hg/hgrc # no-checkcode
 
   $ hg debugsub
   path sub


More information about the Mercurial-devel mailing list