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

login
register
mail settings
Submitter Jun Wu
Date Nov. 30, 2016, 5:34 p.m.
Message ID <e5e4723e0a563f8cd7c0.1480527241@x1c>
Download mbox | patch
Permalink /patch/17803/
State Superseded
Delegated to: Jun Wu
Headers show

Comments

Jun Wu - Nov. 30, 2016, 5:34 p.m.
# HG changeset patch
# User Jun Wu <quark@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".

Patch

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