Mercurial > hg
comparison contrib/check-code.py @ 27560:15b06f306c1f
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
author | timeless <timeless@mozdev.org> |
---|---|
date | Thu, 24 Dec 2015 19:32:14 +0000 |
parents | 28b5c4fcf48d |
children | 8d0a09162d0f |
comparison
equal
deleted
inserted
replaced
27559:d13bcc9fd656 | 27560:15b06f306c1f |
---|---|
476 if debug: | 476 if debug: |
477 print "Skipping %s for %s it doesn't match %s" % ( | 477 print "Skipping %s for %s it doesn't match %s" % ( |
478 name, match, f) | 478 name, match, f) |
479 continue | 479 continue |
480 if "no-" "check-code" in pre: | 480 if "no-" "check-code" in pre: |
481 print "Skipping %s it has no-" "check-code" % f | 481 # If you're looking at this line, it's because a file has: |
482 # no- check- code | |
483 # but the reason to output skipping is to make life for | |
484 # tests easier. So, instead of writing it with a normal | |
485 # spelling, we write it with the expected spelling from | |
486 # tests/test-check-code.t | |
487 print "Skipping %s it has no-che?k-code (glob)" % f | |
482 return "Skip" # skip checking this file | 488 return "Skip" # skip checking this file |
483 for p, r in filters: | 489 for p, r in filters: |
484 post = re.sub(p, r, post) | 490 post = re.sub(p, r, post) |
485 nerrs = len(pats[0]) # nerr elements are errors | 491 nerrs = len(pats[0]) # nerr elements are errors |
486 if warnings: | 492 if warnings: |