2012-10-04 20:30:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2012-10-04 21:27:52 +02:00
|
|
|
SCRIPT_DIR="$(dirname "$0")"
|
2012-10-04 20:30:01 +02:00
|
|
|
EXITCODE=0
|
|
|
|
|
2012-10-15 22:12:16 +02:00
|
|
|
FILTER_IMPORTS="-v imported.but.unused"
|
|
|
|
if [ "$1" = "--imports" ]; then
|
|
|
|
FILTER_IMPORTS="."
|
|
|
|
fi
|
|
|
|
|
2012-10-04 20:30:01 +02:00
|
|
|
if ! "$SCRIPT_DIR"/jslint/check-all; then
|
|
|
|
EXITCODE=1;
|
|
|
|
fi
|
|
|
|
|
2012-10-04 21:27:52 +02:00
|
|
|
cd "$SCRIPT_DIR"/..;
|
|
|
|
|
2012-10-25 19:44:18 +02:00
|
|
|
PYTHON_FILES=""
|
|
|
|
for file in $(git ls-files); do
|
2012-10-25 20:52:36 +02:00
|
|
|
if ([ -f "$file" ] && (head -n1 "$file" | grep -q "^#!.*python" ||
|
2012-10-25 19:44:18 +02:00
|
|
|
echo "$file" | grep -q [.]py$) && \
|
|
|
|
echo "$file" | egrep -vq '^(confirmation/|humbug/test_settings\.py)'); then
|
|
|
|
PYTHON_FILES="$PYTHON_FILES $file"
|
|
|
|
fi
|
|
|
|
done
|
2012-10-20 03:00:05 +02:00
|
|
|
|
|
|
|
if pyflakes $PYTHON_FILES | grep $FILTER_IMPORTS; then
|
2012-10-04 20:30:01 +02:00
|
|
|
EXITCODE=1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit $EXITCODE
|