zulip/tools/check-all

29 lines
660 B
Plaintext
Raw Normal View History

#!/bin/bash
SCRIPT_DIR="$(dirname "$0")"
EXITCODE=0
FILTER_IMPORTS="-v imported.but.unused"
if [ "$1" = "--imports" ]; then
FILTER_IMPORTS="."
fi
if ! "$SCRIPT_DIR"/jslint/check-all; then
EXITCODE=1;
fi
cd "$SCRIPT_DIR"/..;
PYTHON_FILES=$(git ls-files | grep [.]py$ | egrep -v '^(confirmation/|humbug/test_settings\.py)')
for file in $(git ls-files | grep -v [.][^/]*$ | egrep -v '^(confirmation/|humbug/test_settings\.py)'); do
if [ -f "$file" ] && head -n1 "$file" | grep -q "^#!.*python"; then
PYTHON_FILES="$PYTHON_FILES $file"
fi
done
if pyflakes $PYTHON_FILES | grep $FILTER_IMPORTS; then
EXITCODE=1;
fi
exit $EXITCODE