check-all: Detect non-.py Python files by #! line, not a whitelist.

(imported from commit e36ad2fd66688092ed0c81b479b9ff81952751fa)
This commit is contained in:
Tim Abbott 2012-10-25 13:44:18 -04:00
parent b92ac0ffa1
commit 7976262ed8
1 changed files with 8 additions and 16 deletions

View File

@ -14,22 +14,14 @@ fi
cd "$SCRIPT_DIR"/..; cd "$SCRIPT_DIR"/..;
# Some Python files don't have names ending in .py PYTHON_FILES=""
PYTHON_FILES=$(cat <<EOF for file in $(git ls-files); do
api/examples/subscribe if ([ -f "$file" ] && (head -n1 "$file" | grep -q "^#!/usr/bin/python" ||
api/examples/get-public-streams echo "$file" | grep -q [.]py$) && \
api/examples/send-message echo "$file" | egrep -vq '^(confirmation/|humbug/test_settings\.py)'); then
api/examples/print-messages PYTHON_FILES="$PYTHON_FILES $file"
api/examples/print-next-message fi
api/examples/get-subscriptions done
api/check-mirroring
api/gcal-bot
tools/update-deployment
tools/post-receive
EOF
)
PYTHON_FILES="$PYTHON_FILES $(git ls-files | grep '\.py$' | egrep -v '^(confirmation/|humbug/test_settings\.py)')"
if pyflakes $PYTHON_FILES | grep $FILTER_IMPORTS; then if pyflakes $PYTHON_FILES | grep $FILTER_IMPORTS; then
EXITCODE=1; EXITCODE=1;