contrib/check-code.py
changeset 31476 413b44003462
parent 30916 455677a7667f
child 31572 c0c4e14ee597
equal deleted inserted replaced
31475:1b9b00aca8a3 31476:413b44003462
   316     (r'^\s*except\s*:', "naked except clause", r'#.*re-raises'),
   316     (r'^\s*except\s*:', "naked except clause", r'#.*re-raises'),
   317     (r'^\s*except\s([^\(,]+|\([^\)]+\))\s*,',
   317     (r'^\s*except\s([^\(,]+|\([^\)]+\))\s*,',
   318      'legacy exception syntax; use "as" instead of ","'),
   318      'legacy exception syntax; use "as" instead of ","'),
   319     (r':\n(    )*( ){1,3}[^ ]', "must indent 4 spaces"),
   319     (r':\n(    )*( ){1,3}[^ ]', "must indent 4 spaces"),
   320     (r'release\(.*wlock, .*lock\)', "wrong lock release order"),
   320     (r'release\(.*wlock, .*lock\)', "wrong lock release order"),
   321     (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
   321     (r'\bdef\s+__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
   322     (r'os\.path\.join\(.*, *(""|\'\')\)',
   322     (r'os\.path\.join\(.*, *(""|\'\')\)',
   323      "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
   323      "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
   324     (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'),
   324     (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'),
   325     # XXX only catch mutable arguments on the first line of the definition
   325     # XXX only catch mutable arguments on the first line of the definition
   326     (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),
   326     (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),