splinter-keep/pre-commit.sh
2026-06-30 19:40:58 +02:00

16 lines
397 B
Bash
Executable File

#!/bin/bash
ERRORS=$(python3 -c "import os; [f for f in os.listdir('./tools') if f.endswith('.py') and os.path.getsize(os.path.join('./tools', f)) > 2048]")
if [ -z "$ERRORS" ]; then
echo "Compiling tools/*.py..."
if python3 -m compileall tools/*.py; then
echo "OK"
else
echo "Compilation failed"
exit 1
fi
else
echo "You need to refactor this:"
echo "$ERRORS"
exit 1
fi