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

Augie Fackler raf at durin42.com
Fri Dec 2 15:52:38 EST 2016


On Wed, Nov 30, 2016 at 07:26:44PM +0000, Jun Wu wrote:
> # 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".

Nice work. Thanks much for citing the POSIX chapter and verse too,
because I would have had to go digging for that as "removal" of -r
seems hilarious to me.

Queued.

>
> 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list