contrib/check-code.py
changeset 29279 438caf194160
parent 29278 5eda83fb09fc
child 29330 12c97985ddeb
equal deleted inserted replaced
29278:5eda83fb09fc 29279:438caf194160
    51     return re.compile(pat)
    51     return re.compile(pat)
    52 
    52 
    53 def repquote(m):
    53 def repquote(m):
    54     # check "rules depending on implementation of repquote()" in each
    54     # check "rules depending on implementation of repquote()" in each
    55     # patterns (especially pypats), before changing this function
    55     # patterns (especially pypats), before changing this function
    56     fixedmap = {' ': ' ', '\n': '\n', '.': 'p', ':': 'q'}
    56     fixedmap = {' ': ' ', '\n': '\n', '.': 'p', ':': 'q',
       
    57                 '%': '%', '\\': 'b', '*': 'A', '+': 'P', '-': 'M'}
    57     def encodechr(i):
    58     def encodechr(i):
    58         if i > 255:
    59         if i > 255:
    59             return 'u'
    60             return 'u'
    60         c = chr(i)
    61         c = chr(i)
    61         if c in fixedmap:
    62         if c in fixedmap:
   324     (r'^import cStringIO', "don't use cStringIO.StringIO, use util.stringio"),
   325     (r'^import cStringIO', "don't use cStringIO.StringIO, use util.stringio"),
   325     (r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"),
   326     (r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"),
   326     (r'\.next\(\)', "don't use .next(), use next(...)"),
   327     (r'\.next\(\)', "don't use .next(), use next(...)"),
   327 
   328 
   328     # rules depending on implementation of repquote()
   329     # rules depending on implementation of repquote()
   329     (r' x+[xpqo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
   330     (r' x+[xpqo%APM][\'"]\n\s+[\'"]x',
       
   331      'string join across lines with no space'),
   330     (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
   332     (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
   331      "missing _() in ui message (use () to hide false-positives)"),
   333      "missing _() in ui message (use () to hide false-positives)"),
   332   ],
   334   ],
   333   # warnings
   335   # warnings
   334   [
   336   [