#!/bin/bash
FILES=$(git ls-files | egrep "\.py$")

# Remember git hypberblame; .git-blame-ignore-revs file

N=0

for f in ${FILES}
do

python3 -m black -t py36 --line-length 100 ${f}
python3 -m flake8 --ignore=E401 ${f}
if [[ "$?" != "0" ]];
then
    echo "Need to fix $f"
    N=$((N+1))
    if ((N == 4))
    then
	echo "Too many errors, stop"
	exit
    fi
fi

done


