[Reviewers] [Differential] [Closed] D20: check-code: prohibit `if False` antipattern

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Jul 12 20:21:28 UTC 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd36bcba91845: check-code: prohibit `if False` antipattern (authored by durin42).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D20?vs=36&id=91

REVISION DETAIL
  https://phab.mercurial-scm.org/D20

AFFECTED FILES
  contrib/check-code.py

CHANGE DETAILS

Index: contrib/check-code.py
===================================================================
--- contrib/check-code.py
+++ contrib/check-code.py
@@ -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'),


EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: durin42, krbullock
Cc: reviewers


More information about the Reviewers mailing list