Disallow "xrange" function
authorMichael Hanselmann <hansmi@google.com>
Fri, 2 Oct 2009 15:44:29 +0000 (17:44 +0200)
committerMichael Hanselmann <hansmi@google.com>
Fri, 2 Oct 2009 15:53:03 +0000 (17:53 +0200)
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

autotools/check-python-code
pylintrc

index 46f6bc0..dcacbf1 100755 (executable)
@@ -31,6 +31,12 @@ for script; do
     echo "Found end-of-line-whitespace in $script" >&2
   fi
 
+  # FIXME: This will also match "foo.xrange(...)"
+  if grep -n -H -E '^[^#]*\<xrange\>' "$script"; then
+    let ++problems
+    echo "Forbidden function 'xrange' used in $script" >&2
+  fi
+
   if [[ "$(wc --max-line-length < "$script")" -gt 80 ]]; then
     let ++problems
     echo "Longest line in $script is longer than 80 characters" >&2
index 61163e7..e1de46e 100644 (file)
--- a/pylintrc
+++ b/pylintrc
@@ -31,7 +31,7 @@ variable-rgx = (_?([a-z_][a-z0-9_]*)|([A-Z0-9_]+))$
 inlinevar-rgx = [A-Za-z_][A-Za-z0-9_]*$
 good-names = i,j,k,_
 bad-names = foo,bar,baz,toto,tutu,tata
-bad-functions =
+bad-functions = xrange
 
 [TYPECHECK]
 ignore-mixin-members = yes