[PATCH 1 of 5 v3] check-code: allow "grep pattern filename-containing-dash-a"

Augie Fackler raf at durin42.com
Fri Feb 5 16:18:34 EST 2016


On Thu, Feb 04, 2016 at 06:51:43PM -0600, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1454476804 28800
> #      Tue Feb 02 21:20:04 2016 -0800
> # Node ID b028f259a33ba2e4182cfa866f80af38ac6fe62a
> # Parent  01a5143cd25f285f8c745a92986cd7186bb32c90
> check-code: allow "grep pattern filename-containing-dash-a"

Queued this one, thanks. Didn't look at the rest since a resend is pending.

>
> We're trying to forbid "grep -a" and unintentionally complained even
> if the "-a" was part of the filename. Requiring a space before "-a" to
> match is probably good enough.
>
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -90,7 +90,7 @@
>      (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"),
>      (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
>      (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
> -    (r'(?<!hg )grep.*-a', "don't use 'grep -a', use in-line python"),
> +    (r'(?<!hg )grep.* -a', "don't use 'grep -a', use in-line python"),
>      (r'sed.*-i', "don't use 'sed -i', use a temporary file"),
>      (r'\becho\b.*\\n', "don't use 'echo \\n', use printf"),
>      (r'echo -n', "don't use 'echo -n', use printf"),
> _______________________________________________
> 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