changeset 33369:d36bcba91845

check-code: prohibit `if False` antipattern Differential Revision: https://phab.mercurial-scm.org/D20
author Augie Fackler <raf@durin42.com>
date Fri, 07 Jul 2017 15:11:11 -0400
parents ffb30661f672
children 482320104672
files contrib/check-code.py
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Fri Jul 07 15:08:23 2017 -0400
+++ b/contrib/check-code.py	Fri Jul 07 15:11:11 2017 -0400
@@ -301,6 +301,7 @@
      "comparison with singleton, use 'is' or 'is not' instead"),
     (r'^\s*(while|if) [01]:',
      "use True/False for constant Boolean expression"),
+    (r'^\s*if False(:| +and)', 'Remove code instead of using `if False`'),
     (r'(?:(?<!def)\s+|\()hasattr\(',
      'hasattr(foo, bar) is broken on py2, use util.safehasattr(foo, bar) '
      'instead', r'#.*hasattr-py3-only'),