diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit new file mode 100755 index 0000000000000000000000000000000000000000..901668520bdbab97a13aa521b7050e5e12dfd1fe --- /dev/null +++ b/git-hooks/pre-commit @@ -0,0 +1,20 @@ +#!/bin/bash + +echo "[Pre-Commit] Checking code style" +pdm run flake8 src/pystencilssfg +status=$? + +if [ ${status} != 0 ]; then + exit 1 +else + echo "[Pre-Commit] Style OK!" +fi + +echo "[Pre-Commit] Checking types" +pdm run mypy src/pystencilssfg +status=$? +if [ ${status} != 0 ]; then + exit 1 +else + echo "[Pre-Commit] Types OK!" +fi diff --git a/install_git_hooks.sh b/install_git_hooks.sh new file mode 100644 index 0000000000000000000000000000000000000000..eeb1b614f17000f08eb3b1853e66e23e895a82cb --- /dev/null +++ b/install_git_hooks.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cp git-hooks/pre-commit .git/hooks/pre-commit +chmod +x .git/hooks/pre-commit +