[PATCH] check-code: grep's context flags don't need an extra space before number

Anton Shestakov av6 at dwimlabs.net
Sat Nov 18 05:06:21 UTC 2017


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1510981247 -28800
#      Sat Nov 18 13:00:47 2017 +0800
# Node ID 37a6f2a93c9e26a5534a421c0351bcca2bf59062
# Parent  38e695b081ed5fdbaad1da0df6d8236ace5a9f29
# EXP-Topic hgweb-more-info
check-code: grep's context flags don't need an extra space before number

A bit of useless trivia found while researching this: OpenBSD's grep's -C has a
default value (of 2) and disallows space before the argument (while -A and -B
allow).

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


More information about the Mercurial-devel mailing list