[PATCH 2 of 2] check-code: add a rule to forbid "cp -r"
Jun Wu
quark at fb.com
Wed Nov 30 17:34:01 UTC 2016
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1480526607 0
# Wed Nov 30 17:23:27 2016 +0000
# Node ID e5e4723e0a563f8cd7c00de1986635a5d1e9d8d1
# Parent a4f46a03e5f8e33f32c36326c6b14b84d9cb03b4
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r e5e4723e0a56
check-code: add a rule to forbid "cp -r"
"cp -r" is not portable (not defined by POSIX, and not documented in the OS
X's man page). This patch adds a rule to forbid it and suggests "cp -R".
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