Skip to content

Instantly share code, notes, and snippets.

@matthewstory
Created May 14, 2013 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewstory/5573424 to your computer and use it in GitHub Desktop.
Save matthewstory/5573424 to your computer and use it in GitHub Desktop.
#!/bin/sh
# git post-commit hook for pyflakes'ing modified files
git log --oneline --name-only | sed -n '2,$p' | while read f; do
if [ "${f%.py}" != "$f" -a -e "$f" ]; then
echo "$f"
elif file "$f" 2> /dev/null | grep python > /dev/null 2>&1; then
echo "$f"
fi
done | xargs pyflakes || echo "PYFLAKES FAILED, PLEASE INSPECT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment