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

login
register
mail settings
Submitter Anton Shestakov
Date Nov. 18, 2017, 5:06 a.m.
Message ID <37a6f2a93c9e26a5534a.1510981581@neuro>
Download mbox | patch
Permalink /patch/25636/
State Accepted
Headers show

Comments

Anton Shestakov - Nov. 18, 2017, 5:06 a.m.
# HG changeset patch
# User Anton Shestakov <av6@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).
Yuya Nishihara - Nov. 19, 2017, 3:45 a.m.
On Sat, 18 Nov 2017 13:06:21 +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6@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

Queued, thanks.

Patch

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
   [