Commit 9ec2d55a authored by Benoît du Garreau's avatar Benoît du Garreau

Add pre-commit

parent 3f34d0cf
#!/bin/bash
files=$(git ls-files | git status --porcelain | grep .py | while read l; do echo "$l" | cut -d\ -f2; done)
code=0
for f in $files; do
if [ -f "$f" ] && echo "$f" | grep .py > /dev/null; then
i=0
while IFS='' read -r l; do
((i++))
while IFS='' read -r -d '' -n 1 c; do
if [ "$c" = " " ]; then
echo -e "\033[01;31mErreur : Utilisation d'espaces pour indenter : \""$f"\" ligne "$i"\033[0m"
code=1
elif [ "$c" != '\t' ]; then
break
fi
done <<< "$(echo "$l")"
done < "$f"
fi
done
exit $code
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment