##// END OF EJS Templates
contrib: refactor preparation logic for patterns of check-code.py...
FUJIWARA Katsunori -
r41988:55ae5cd3 default
parent child Browse files
Show More
@@ -561,8 +561,7 b' checks = ['
561 ]
561 ]
562
562
563 def _preparepats():
563 def _preparepats():
564 for c in checks:
564 def preparefailandwarn(failandwarn):
565 failandwarn = c[-1]
566 for pats in failandwarn:
565 for pats in failandwarn:
567 for i, pseq in enumerate(pats):
566 for i, pseq in enumerate(pats):
568 # fix-up regexes for multi-line searches
567 # fix-up regexes for multi-line searches
@@ -576,10 +575,19 b' def _preparepats():'
576 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
575 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
577
576
578 pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:]
577 pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:]
579 filters = c[3]
578
579 def preparefilters(filters):
580 for i, flt in enumerate(filters):
580 for i, flt in enumerate(filters):
581 filters[i] = re.compile(flt[0]), flt[1]
581 filters[i] = re.compile(flt[0]), flt[1]
582
582
583 for cs in (checks,):
584 for c in cs:
585 failandwarn = c[-1]
586 preparefailandwarn(failandwarn)
587
588 filters = c[-2]
589 preparefilters(filters)
590
583 class norepeatlogger(object):
591 class norepeatlogger(object):
584 def __init__(self):
592 def __init__(self):
585 self._lastseen = None
593 self._lastseen = None
General Comments 0
You need to be logged in to leave comments. Login now