Created
April 10, 2025 18:08
-
-
Save markuskreitzer/5f2a855161a0b1fa72cc3d79c055b85f to your computer and use it in GitHub Desktop.
Python Pre-Commit Hooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| echo "Running Checks..." | |
| poetry run flake8 src tests \ | |
| && poetry run black src tests \ | |
| && poetry run isort src tests \ | |
| && poetry run pytest \ | |
| && poetry run bandit src \ | |
| && poetry run pip-audit . \ | |
| && poetry run mypy src tests | |
| # && poetry run safety scan | |
| # Store the exit code | |
| RESULT=$? | |
| if [ $RESULT -ne 0 ]; then | |
| echo "We found code style issues. Please fix them before committing." | |
| exit 1 | |
| fi | |
| echo "All checks passed. Proceeding with commit." | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment