Use only tracked Python files

This commit is contained in:
Laurent Bachelier 2013-04-05 18:57:22 +02:00
commit 0aa4fd3ede

View file

@ -1,8 +1,9 @@
#!/bin/bash -u #!/bin/bash -u
cd $(dirname $0) cd $(dirname $0)
cd .. cd ..
grep -r --include '*.py' 'class [^( ]\+:$' . && exit 3 PYFILES=$(git ls-files|grep '^scripts\|\.py$'|grep -v boilerplate_data|tr '\n' ' ')
grep -r --include '*.py' $'\t\|\s$' . && exit 4 grep 'class [^( ]\+:$' ${PYFILES} && exit 3
grep $'\t\|\s$' $PYFILES && exit 4
FLAKE8="" FLAKE8=""
if which flake8 >/dev/null 2>&1; then if which flake8 >/dev/null 2>&1; then
@ -14,9 +15,9 @@ fi
if [ -n "${FLAKE8}" ]; then if [ -n "${FLAKE8}" ]; then
set -e set -e
${FLAKE8} --ignore=E,W --exclude='*_ui.py' *.py weboob modules contrib docs scripts/* tools/*.py ${FLAKE8} --ignore=E,W --exclude='*_ui.py' *.py $PYFILES
else else
# grep will return 0 only if it founds something, but our script # grep will return 0 only if it founds something, but our script
# wants to return 0 when it founds nothing! # wants to return 0 when it founds nothing!
pyflakes *.py weboob modules contrib docs scripts/* tools/*.py | grep -v redefinition && exit 1 || exit 0 pyflakes $PYFILES | grep -v redefinition && exit 1 || exit 0
fi fi