Commit a3fe32c8 authored by ntome's avatar ntome

tools/pyflakes.sh: run pyflakes3 on all modules, not just declared modules

Since all code is supposed to be python3 compatible, we should not
restrict files passing through pyflakes3.
parent e7e592d1
Pipeline #2721 canceled with stages
......@@ -5,13 +5,9 @@ err=0
cd $(dirname $0)/..
PY3MODS=$(grep -v '^#' ./tools/py3-compatible.modules|tr '\n' '|'|sed 's/|$//')
MODULE_FILES=$(git ls-files modules|grep '\.py$')
MODULE_FILES3=$(printf "%s\n" $MODULE_FILES|grep -E -w "^modules/(${PY3MODS})")
PYFILES=$(git ls-files | grep '^scripts\|\.py$'|grep -v boilerplate_data|grep -v stable_backport_data|grep -v '^modules'|grep -v '^contrib')
PYFILES3="$PYFILES $MODULE_FILES3"
PYFILES="$PYFILES $MODULE_FILES"
grep -n 'class [^( ]\+:$' ${PYFILES} && echo 'Error: old class style found, always inherit object' && err=3
grep -n '[[:space:]]$' ${PYFILES} && echo 'Error: tabs or trailing whitespace found, remove them' && err=4
......@@ -23,12 +19,12 @@ grep -Fn ".has_key" ${PYFILES} && echo 'Error: Deprecated, use operator "in"' &&
grep -Fn "os.isatty" ${PYFILES} && echo 'Error: Use stream.isatty() instead of os.isatty(stream.fileno())' && err=10
grep -Fn "raise StopIteration" ${PYFILES} && echo 'Error: PEP 479' && err=11
grep -nE "\.iter(keys|values|items)\(\)" ${PYFILES3} | grep -Fv "six.iter" && echo 'Error: iterkeys/itervalues/iteritems is forbidden' && err=12
grep -nE "\.iter(keys|values|items)\(\)" ${PYFILES} | grep -Fv "six.iter" && echo 'Error: iterkeys/itervalues/iteritems is forbidden' && err=12
grep -nE "^ *print(\(| )" ${MODULE_FILES} && echo 'Error: Use of print in modules is forbidden, use logger instead' && err=20
grep -n xrange ${MODULE_FILES3} && echo 'Error: xrange is forbidden' && err=21
grep -nE "from (urllib|urlparse) import" ${MODULE_FILES3} && echo 'Error: python2 urllib is forbidden' && err=22
grep -nE "^import (urllib|urlparse)$" ${MODULE_FILES3} && echo 'Error: python2 urllib is forbidden' && err=22
grep -n xrange ${MODULE_FILES} && echo 'Error: xrange is forbidden' && err=21
grep -nE "from (urllib|urlparse) import" ${MODULE_FILES} && echo 'Error: python2 urllib is forbidden' && err=22
grep -nE "^import (urllib|urlparse)$" ${MODULE_FILES} && echo 'Error: python2 urllib is forbidden' && err=22
grep -nE "HEADLESS[[:space:]]*=[[:space:]]*False" ${MODULE_FILES} && echo 'Error: HEADLESS must be set back to True' && err=23
if [ ${VER} -eq 2 ]
......@@ -61,7 +57,7 @@ then
err=1
fi
if [ ${err} -ne 1 ]; then
$PYTHON3 -m ${FLAKER3} ${OPT3} ${PYFILES3} || exit 33
$PYTHON3 -m ${FLAKER3} ${OPT3} ${PYFILES} || exit 33
fi
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment