Patchwork [3,of,4] check-code: capture "wc" as a word

mail settings
Submitter Pierre-Yves David
Date Aug. 8, 2014, 10:27 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/5332/
State Accepted
Headers show


Pierre-Yves David - Aug. 8, 2014, 10:27 p.m.
# HG changeset patch
# User Pierre-Yves David <>
# Date 1407024115 25200
#      Sat Aug 02 17:01:55 2014 -0700
# Node ID 8fc5b99e6d48a053331c6f28cdd43aa255211255
# Parent  ef62b424770799e3e9e970f7e0ef4a3493f72211
check-code: capture "wc" as a word

Otherwise entries such as "wcchange" give false negative


diff --git a/contrib/ b/contrib/
--- a/contrib/
+++ b/contrib/
@@ -92,11 +92,11 @@  testpats = [
     (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'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"),
-    (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"),
+    (r'(^| )\bwc\b[^|]*$\n(?!.*\(re\))', "filter wc output"),
     (r'head -c', "don't use 'head -c', use 'dd'"),
     (r'tail -n', "don't use the '-n' option to tail, just use '-<num>'"),
     (r'sha1sum', "don't use sha1sum, use $TESTDIR/"),
     (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
     (r'printf.*[^\\]\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"),