Patchwork check-code: ban grep's context flags (-A/-B/-C) since they're not on Solaris

login
register
mail settings
Submitter Danek Duvall
Date June 6, 2017, 4 p.m.
Message ID <0250869949d7d7e5e9c5.1496764835@smelly>
Download mbox | patch
Permalink /patch/21220/
State Accepted
Headers show

Comments

Danek Duvall - June 6, 2017, 4 p.m.
# HG changeset patch
# User Danek Duvall <danek.duvall@oracle.com>
# Date 1496764707 25200
#      Tue Jun 06 08:58:27 2017 -0700
# Node ID 0250869949d7d7e5e9c5b28d3c7cca61a46c80f3
# Parent  67209fdbca98cf2a38b05cb06f093dc376803590
check-code: ban grep's context flags (-A/-B/-C) since they're not on Solaris
Augie Fackler - June 6, 2017, 6 p.m.
> On Jun 6, 2017, at 12:00, danek.duvall@oracle.com wrote:
> 
> # HG changeset patch
> # User Danek Duvall <danek.duvall@oracle.com>
> # Date 1496764707 25200
> #      Tue Jun 06 08:58:27 2017 -0700
> # Node ID 0250869949d7d7e5e9c5b28d3c7cca61a46c80f3
> # Parent  67209fdbca98cf2a38b05cb06f093dc376803590
> check-code: ban grep's context flags (-A/-B/-C) since they're not on Solaris

Queued, thanks.

Maybe Solaris should get on the https://svnweb.freebsd.org/base/head/usr.bin/grep/ bandwagon ;)

> 
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -145,6 +145,7 @@ testpats = [
>     (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'cp.* -r ', "don't use 'cp -r', use 'cp -R'"),
> +    (r'grep.* -[ABC] ', "don't use grep's context flags"),
>   ],
>   # warnings
>   [
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Danek Duvall - June 6, 2017, 6:19 p.m.
Augie Fackler wrote:

> 
> > On Jun 6, 2017, at 12:00, danek.duvall@oracle.com wrote:
> > 
> > # HG changeset patch
> > # User Danek Duvall <danek.duvall@oracle.com>
> > # Date 1496764707 25200
> > #      Tue Jun 06 08:58:27 2017 -0700
> > # Node ID 0250869949d7d7e5e9c5b28d3c7cca61a46c80f3
> > # Parent  67209fdbca98cf2a38b05cb06f093dc376803590
> > check-code: ban grep's context flags (-A/-B/-C) since they're not on Solaris
> 
> Queued, thanks.
> 
> Maybe Solaris should get on the https://svnweb.freebsd.org/base/head/usr.bin/grep/ bandwagon ;)

Believe me, we're not short of ideas on what we could do.  :(

Danek

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -145,6 +145,7 @@  testpats = [
     (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'cp.* -r ', "don't use 'cp -r', use 'cp -R'"),
+    (r'grep.* -[ABC] ', "don't use grep's context flags"),
   ],
   # warnings
   [