Mercurial > public > mercurial-scm > hg-stable
comparison contrib/check-code.py @ 19382:5aeb03b48ab4
check-code: concatenate "check-code" on compile time
The python compiler concatenates two string constants. Use this instead of
doing it on run time or instruct the user how to do it.
The strings "no-check-code" and "check-code-ignore" has to be specially written
for not skipping some checking of the code of this file.
author | Simon Heimberg <simohe@besonet.ch> |
---|---|
date | Mon, 01 Jul 2013 06:50:58 +0200 |
parents | ee07f9d142c9 |
children | d9e86d656017 |
comparison
equal
deleted
inserted
replaced
19381:e033a7d444ac | 19382:5aeb03b48ab4 |
---|---|
408 name, match, f) | 408 name, match, f) |
409 continue | 409 continue |
410 fp = open(f) | 410 fp = open(f) |
411 pre = post = fp.read() | 411 pre = post = fp.read() |
412 fp.close() | 412 fp.close() |
413 if "no-" + "check-code" in pre: | 413 if "no-" "check-code" in pre: |
414 if debug: | 414 if debug: |
415 print "Skipping %s for %s it has no- and check-code" % ( | 415 print "Skipping %s for %s it has no-" " check-code" % ( |
416 name, f) | 416 name, f) |
417 break | 417 break |
418 for p, r in filters: | 418 for p, r in filters: |
419 post = re.sub(p, r, post) | 419 post = re.sub(p, r, post) |
420 if warnings: | 420 if warnings: |
449 break | 449 break |
450 pos += step | 450 pos += step |
451 n += 1 | 451 n += 1 |
452 l = prelines[n] | 452 l = prelines[n] |
453 | 453 |
454 if "check-code" + "-ignore" in l: | 454 if "check-code" "-ignore" in l: |
455 if debug: | 455 if debug: |
456 print "Skipping %s for %s:%s (check-code -ignore)" % ( | 456 print "Skipping %s for %s:%s (check-code" "-ignore)" % ( |
457 name, f, n) | 457 name, f, n) |
458 continue | 458 continue |
459 elif ignore and re.search(ignore, l, re.MULTILINE): | 459 elif ignore and re.search(ignore, l, re.MULTILINE): |
460 continue | 460 continue |
461 bd = "" | 461 bd = "" |