Patchwork D1037: check-code: suggest pycompat.is(posix|windows|darwin)

login
register
mail settings
Submitter phabricator
Date Oct. 12, 2017, 4:37 p.m.
Message ID <differential-rev-PHID-DREV-obop6wbcn3miy2f7o26m-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24796/
State Superseded
Headers show

Comments

phabricator - Oct. 12, 2017, 4:37 p.m.
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/check-code.py

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -363,6 +363,9 @@ 
     (r'([a-z]*).revision\(\1\.node\(',
      "don't convert rev to node before passing to revision(nodeorrev)"),
     (r'platform\.system\(\)', "don't use platform.system(), use pycompat"),
+    (r'pycompat\.osname\s*==\s*[\'"]nt[\'"]', "use pycompat.iswindows"),
+    (r'pycompat\.osname\s*==\s*[\'"]posix[\'"]', "use pycompat.isposix"),
+    (r'pycompat\.sysplatform\s*==[\'"]darwin[\'"]', "use pycompat.isdarwin"),
 
     # rules depending on implementation of repquote()
     (r' x+[xpqo%APM][\'"]\n\s+[\'"]x',