home · contact · privacy
On pre-commit hook run, clean up potential test db files.
[plomtask] / scripts / pre-commit
index e1cfb733180349084416dae48f301d795815ffc2..e4493a6f34eb279064d6e49e23ea02039f8f4e06 100755 (executable)
@@ -1,6 +1,16 @@
 #!/bin/sh
 set -e
-python3 -m mypy *.py
-python3 -m flake8 *.py
-python3 -m pylint --good-names 'do_GET,do_POST' *.py
+for dir in $(echo '.' 'plomtask' 'tests'); do
+    echo "Running mypy on ${dir}/ …."
+    python3 -m mypy --strict ${dir}/*.py
+    echo "Running flake8 on ${dir}/ …"
+    python3 -m flake8 ${dir}/*.py
+    echo "Running pylint on ${dir}/ …"
+    python3 -m pylint ${dir}/*.py
+done
+echo "Running unittest on tests/."
+set +e
+python3 -m unittest tests/*.py
+rm test_db:*.*
+set -e
 exit 0