[PATCH RFC] check-code: add rule for os.remove/unlink and friends

Idan Kamara idankk86 at gmail.com
Mon Oct 8 09:26:55 CDT 2012


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1349706107 -7200
# Branch stable
# Node ID 0561e2d7dd3770ddcd2a0f27e009b767ddbea5f7
# Parent  6cd5ee6df3c463d2025cf17158c4ad8ca484d00f
check-code: add rule for os.remove/unlink and friends

I seem to remember util.unlink/unlinkpaths were born because of issues
we had on Windows. Should we enforce this on the entire codebase?

If so, I'll send a patch before this one that fixes all the errors.

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -207,6 +207,8 @@
     (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"),
     (r'^\s*except\s*:', "warning: naked except clause", r'#.*re-raises'),
     (r':\n(    )*( ){1,3}[^ ]', "must indent 4 spaces"),
+    (r'os\.(remove|removedirs|unlink|unlinkdirs)',
+     "use util.unlink/unlinkpaths"),
   ],
   # warnings
   [


More information about the Mercurial-devel mailing list