Mercurial > hg-stable
diff contrib/check-code.py @ 29279:438caf194160
check-code: make repquote distinguish more characters for exact detection
This patch makes repquote() distinguish more characters below, as a
preparation for exact detection in subsequent patch.
- "%" as "%"
- "\\" as "b"(ackslash)
- "*" as "A"(sterisk)
- "+" as "P"(lus)
- "-" as "M"(inus)
Characters other than "%" don't use itself as replacement, because
they are treated as special ones in regexp.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 31 May 2016 21:02:30 +0900 |
parents | 5eda83fb09fc |
children | 12c97985ddeb |
line wrap: on
line diff
--- a/contrib/check-code.py Tue May 31 21:02:30 2016 +0900 +++ b/contrib/check-code.py Tue May 31 21:02:30 2016 +0900 @@ -53,7 +53,8 @@ def repquote(m): # check "rules depending on implementation of repquote()" in each # patterns (especially pypats), before changing this function - fixedmap = {' ': ' ', '\n': '\n', '.': 'p', ':': 'q'} + fixedmap = {' ': ' ', '\n': '\n', '.': 'p', ':': 'q', + '%': '%', '\\': 'b', '*': 'A', '+': 'P', '-': 'M'} def encodechr(i): if i > 255: return 'u' @@ -326,7 +327,8 @@ (r'\.next\(\)', "don't use .next(), use next(...)"), # rules depending on implementation of repquote() - (r' x+[xpqo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), + (r' x+[xpqo%APM][\'"]\n\s+[\'"]x', + 'string join across lines with no space'), (r'ui\.(status|progress|write|note|warn)\([\'\"]x', "missing _() in ui message (use () to hide false-positives)"), ],