Patchwork [4,of,4] check-code: allow an escape patter to be specified for testpattern

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 8, 2014, 10:27 p.m.
Message ID <274a15f65ecbb3718c4f.1407536878@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5333/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 8, 2014, 10:27 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1407024293 25200
#      Sat Aug 02 17:04:53 2014 -0700
# Node ID 274a15f65ecbb3718c4fbd35da6b819ba7ce59f2
# Parent  8fc5b99e6d48a053331c6f28cdd43aa255211255
check-code: allow an escape patter to be specified for testpattern

Before this patch it was impossible to introduce a #no-xxx comment to disable a
test pattern warning.
Matt Mackall - Aug. 11, 2014, 3:13 p.m.
On Fri, 2014-08-08 at 15:27 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1407024293 25200
> #      Sat Aug 02 17:04:53 2014 -0700
> # Node ID 274a15f65ecbb3718c4fbd35da6b819ba7ce59f2
> # Parent  8fc5b99e6d48a053331c6f28cdd43aa255211255
> check-code: allow an escape patter to be specified for testpattern

1, 3, and 4 are queued for default, thanks (after restoring a gratuitous
removal of an issue number in 1).
Pierre-Yves David - Aug. 11, 2014, 5:52 p.m.
On 08/11/2014 08:13 AM, Matt Mackall wrote:
> On Fri, 2014-08-08 at 15:27 -0700, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>> # Date 1407024293 25200
>> #      Sat Aug 02 17:04:53 2014 -0700
>> # Node ID 274a15f65ecbb3718c4fbd35da6b819ba7ce59f2
>> # Parent  8fc5b99e6d48a053331c6f28cdd43aa255211255
>> check-code: allow an escape patter to be specified for testpattern
>
> 1, 3, and 4 are queued for default, thanks (after restoring a gratuitous
> removal of an issue number in 1).

The issue number was actually just move a few line up (in the "section" 
header). I got confused myself a couple of time while reviewing this diff.

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -177,16 +177,18 @@  utestpats = [
      "glob match with no glob character (?*/)"),
   ]
 ]
 
 for i in [0, 1]:
-    for p, m in testpats[i]:
+    for tp in testpats[i]:
+        p = tp[0]
+        m = tp[1]
         if p.startswith(r'^'):
             p = r"^  [$>] (%s)" % p[1:]
         else:
             p = r"^  [$>] .*(%s)" % p
-        utestpats[i].append((p, m))
+        utestpats[i].append((p, m) + tp[2:])
 
 utestfilters = [
     (r"<<(\S+)((.|\n)*?\n  > \1)", rephere),
     (r"( *)(#([^\n]*\S)?)", repcomment),
 ]