contrib/check-code.py
changeset 33369 d36bcba91845
parent 33288 f08a178adadf
child 34060 e267d4ee4f2d
equal deleted inserted replaced
33368:ffb30661f672 33369:d36bcba91845
   299     (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
   299     (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
   300     (r' [=!]=\s+(True|False|None)',
   300     (r' [=!]=\s+(True|False|None)',
   301      "comparison with singleton, use 'is' or 'is not' instead"),
   301      "comparison with singleton, use 'is' or 'is not' instead"),
   302     (r'^\s*(while|if) [01]:',
   302     (r'^\s*(while|if) [01]:',
   303      "use True/False for constant Boolean expression"),
   303      "use True/False for constant Boolean expression"),
       
   304     (r'^\s*if False(:| +and)', 'Remove code instead of using `if False`'),
   304     (r'(?:(?<!def)\s+|\()hasattr\(',
   305     (r'(?:(?<!def)\s+|\()hasattr\(',
   305      'hasattr(foo, bar) is broken on py2, use util.safehasattr(foo, bar) '
   306      'hasattr(foo, bar) is broken on py2, use util.safehasattr(foo, bar) '
   306      'instead', r'#.*hasattr-py3-only'),
   307      'instead', r'#.*hasattr-py3-only'),
   307     (r'opener\([^)]*\).read\(',
   308     (r'opener\([^)]*\).read\(',
   308      "use opener.read() instead"),
   309      "use opener.read() instead"),