comparison contrib/check-code.py @ 31602:772878ac930e

checkcode: enforce lowercase for extension docstring title This will ensure new extensions are consistent and `hg help -e` has a consistent output. I have to add a new group since the normal "pypats" will be filtered by "pyfilters", which will remove comments and docstrings.
author Jun Wu <quark@fb.com>
date Thu, 23 Mar 2017 21:23:21 -0700
parents c0c4e14ee597
children 6a2959acae1a
comparison
equal deleted inserted replaced
31601:8e7feaad2d8d 31602:772878ac930e
369 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) 369 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
370 (?P<text>(([^\\]|\\.)*?)) 370 (?P<text>(([^\\]|\\.)*?))
371 (?P=quote))""", reppython), 371 (?P=quote))""", reppython),
372 ] 372 ]
373 373
374 # extension non-filter patterns
375 pyextnfpats = [
376 [(r'^"""\n?[A-Z]', "don't capitalize docstring title")],
377 # warnings
378 [],
379 ]
380
374 txtfilters = [] 381 txtfilters = []
375 382
376 txtpats = [ 383 txtpats = [
377 [ 384 [
378 ('\s$', 'trailing whitespace'), 385 ('\s$', 'trailing whitespace'),
478 [], 485 [],
479 ] 486 ]
480 487
481 checks = [ 488 checks = [
482 ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats), 489 ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
490 ('python', r'.*hgext.*\.py$', '', [], pyextnfpats),
483 ('python 3', r'.*(hgext|mercurial).*(?<!pycompat)\.py', '', 491 ('python 3', r'.*(hgext|mercurial).*(?<!pycompat)\.py', '',
484 pyfilters, py3pats), 492 pyfilters, py3pats),
485 ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats), 493 ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
486 ('c', r'.*\.[ch]$', '', cfilters, cpats), 494 ('c', r'.*\.[ch]$', '', cfilters, cpats),
487 ('unified test', r'.*\.t$', '', utestfilters, utestpats), 495 ('unified test', r'.*\.t$', '', utestfilters, utestpats),