Patchwork check-code: improve test-check-code error diffs

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 24, 2015, 7:36 p.m.
Message ID <c834b8d1300bf7012dfb.1450985818@waste.org>
Download mbox | patch
Permalink /patch/12345/
State Accepted
Headers show

Comments

timeless@mozdev.org - Dec. 24, 2015, 7:36 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1450985534 0
#      Thu Dec 24 19:32:14 2015 +0000
# Node ID c834b8d1300bf7012dfbf769007ada213f5c73d1
# Parent  e2aa9c4030c4109e5efa50462ffc6048ca30106f
check-code: improve test-check-code error diffs

Whenever check-code finds something wrong, the diffs it
generated were fairly hard to read.

The problem is that check-code before this change
would list files that were white listed using
no- check- code but without a glob marker.

Whereas, the test-check-code.t expected output has
no-che?k-code (glob) in order to avoid having itself
flagged as a file to skip.

Thus, in addition to any lines relating to things you
did wrong, all of the white-listed files are listed as
changed.

There is no reason for things to be this painful.

This change makes the output from check-code.py match
the expected output in test-check-code.t
Augie Fackler - Dec. 29, 2015, 10:42 p.m.
On Thu, Dec 24, 2015 at 01:36:58PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1450985534 0
> #      Thu Dec 24 19:32:14 2015 +0000
> # Node ID c834b8d1300bf7012dfbf769007ada213f5c73d1
> # Parent  e2aa9c4030c4109e5efa50462ffc6048ca30106f
> check-code: improve test-check-code error diffs

Sure, queued. Thanks!

>
> Whenever check-code finds something wrong, the diffs it
> generated were fairly hard to read.
>
> The problem is that check-code before this change
> would list files that were white listed using
> no- check- code but without a glob marker.
>
> Whereas, the test-check-code.t expected output has
> no-che?k-code (glob) in order to avoid having itself
> flagged as a file to skip.
>
> Thus, in addition to any lines relating to things you
> did wrong, all of the white-listed files are listed as
> changed.
>
> There is no reason for things to be this painful.
>
> This change makes the output from check-code.py match
> the expected output in test-check-code.t
>
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -477,7 +477,13 @@
>                         name, match, f)
>              continue
>          if "no-" "check-code" in pre:
> -            print "Skipping %s it has no-" "check-code" % f
> +            # If you're looking at this line, it's because a file has:
> +            # no- check- code
> +            # but the reason to output skipping is to make life for
> +            # tests easier. So, instead of writing it with a normal
> +            # spelling, we write it with the expected spelling from
> +            # tests/test-check-code.t
> +            print "Skipping %s it has no-che?k-code (glob)" % f
>              return "Skip" # skip checking this file
>          for p, r in filters:
>              post = re.sub(p, r, post)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -477,7 +477,13 @@ 
                        name, match, f)
             continue
         if "no-" "check-code" in pre:
-            print "Skipping %s it has no-" "check-code" % f
+            # If you're looking at this line, it's because a file has:
+            # no- check- code
+            # but the reason to output skipping is to make life for
+            # tests easier. So, instead of writing it with a normal
+            # spelling, we write it with the expected spelling from
+            # tests/test-check-code.t
+            print "Skipping %s it has no-che?k-code (glob)" % f
             return "Skip" # skip checking this file
         for p, r in filters:
             post = re.sub(p, r, post)