comparison contrib/check-code.py @ 21487:c26464ce0781

check-code: check for consistent usage of the websub filter in hgweb templates The check-code tool now expects the "desc" keyword to be followed by the "websub" filter, with the following exceptions: a) It has no filters at all, e.g. a changeset description in the raw style templates or the repository description in the summary page. b) It is followed by the "firstline" filter, e.g. the first line of the changeset description is displayed as a summary or title.
author Steven Brown <StevenGBrown@gmail.com>
date Sat, 17 May 2014 17:11:06 +0800
parents 4840abc83970
children fb16f6da5b3b
comparison
equal deleted inserted replaced
21486:16352b34e32e 21487:c26464ce0781
365 ], 365 ],
366 # warnings 366 # warnings
367 [] 367 []
368 ] 368 ]
369 369
370 webtemplatefilters = []
371
372 webtemplatepats = [
373 [],
374 [
375 (r'{desc(\|(?!websub|firstline)[^\|]*)+}',
376 'follow desc keyword with either firstline or websub'),
377 ]
378 ]
379
370 checks = [ 380 checks = [
371 ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats), 381 ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
372 ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats), 382 ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
373 ('c', r'.*\.[ch]$', '', cfilters, cpats), 383 ('c', r'.*\.[ch]$', '', cfilters, cpats),
374 ('unified test', r'.*\.t$', '', utestfilters, utestpats), 384 ('unified test', r'.*\.t$', '', utestfilters, utestpats),
375 ('layering violation repo in revlog', r'mercurial/revlog\.py', '', 385 ('layering violation repo in revlog', r'mercurial/revlog\.py', '',
376 pyfilters, inrevlogpats), 386 pyfilters, inrevlogpats),
377 ('layering violation ui in util', r'mercurial/util\.py', '', pyfilters, 387 ('layering violation ui in util', r'mercurial/util\.py', '', pyfilters,
378 inutilpats), 388 inutilpats),
379 ('txt', r'.*\.txt$', '', txtfilters, txtpats), 389 ('txt', r'.*\.txt$', '', txtfilters, txtpats),
390 ('web template', r'mercurial/templates/.*\.tmpl', '',
391 webtemplatefilters, webtemplatepats),
380 ] 392 ]
381 393
382 def _preparepats(): 394 def _preparepats():
383 for c in checks: 395 for c in checks:
384 failandwarn = c[-1] 396 failandwarn = c[-1]