Skip to content

Useful Hooks

alanbriolat edited this page Sep 13, 2012 · 7 revisions

Useful Hooks

pre-commit

Check the code conforms to PEP 8:

#!/bin/sh
git stash -q --keep-index
pep8 .
RESULT=$?
git stash pop -q
exit $RESULT

Run tests, PEP8 style checker and lint checker:

#!/bin/sh
trial csbot
if [ $? -ne "0" ] ; then
    echo "pre-commit: tests failed"
    exit 1
fi
flake8 csbot
if [ $? -ne "0" ] ; then
    echo "pre-commit: flake8 failed"
    exit 1
fi
Clone this wiki locally