#!/usr/bin/env bash

# To install:
#
#    pip3 install git-pylint-commit-hook mypy
#    chmod +x pre-commit
#    ln -s pre-commit ../.git/hooks

git-pylint-commit-hook

# From .git/hooks
BASE=`dirname $0`/../..
cd $BASE || exit 1
BASE=`pwd`
for mypy_file in faucet/faucet.py faucet/gauge.py ; do
    PYTHONPATH=$BASE mypy --ignore-missing-imports $mypy_file || exit 1
done
cd tests
for t in test_*.py ; do
    cd $BASE/tests && PYTHONPATH=$BASE python3 $t || exit 1
done
