[PATCH 2 of 2 V2] check-code: add a rule to forbid "cp -r"

Jun Wu quark at fb.com
Wed Nov 30 14:26:44 EST 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1480533784 0
#      Wed Nov 30 19:23:04 2016 +0000
# Node ID ff3e01283fa1843920ad63dc1ff7bc6b0a4dbccb
# Parent  830986c78bb9697057768d64c8556d1dc03c0674
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r ff3e01283fa1
check-code: add a rule to forbid "cp -r"

See the commit message of the previous patch for the reason. In short,
according to the current POSIX standard, "-r" is "removed", and "-R" is the
current standard way to do "copy file hierarchies".

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -143,5 +143,6 @@ testpats = [
     (r'\w =  +\w', "only one space after = allowed"),
     (r'\bsed\b.*[^\\]\\n', "don't use 'sed ... \\n', use a \\ and a newline"),
-    (r'env.*-u', "don't use 'env -u VAR', use 'unset VAR'")
+    (r'env.*-u', "don't use 'env -u VAR', use 'unset VAR'"),
+    (r'cp.* -r ', "don't use 'cp -r', use 'cp -R'"),
   ],
   # warnings


More information about the Mercurial-devel mailing list