devine
devine copied to clipboard
Add MyPy Hook to Pre-Commit and GitHub CI Workflow
Is your feature request related to a problem? Please describe. Currently, MyPy linting is not enforced nor checked. Developers can of course still opt-in to using and following MyPy, but without it being enforced it sheds a lot of the weight on fixing and testing for MyPy on a smaller subset of the developers.
Describe the solution you'd like
Add the following to .pre-commit-config.yaml:
- repo: https://github.com/mtkennerly/pre-commit-hooks
rev: v0.3.0
hooks:
- id: poetry-mypy
This should be used over other forms of MyPy hooks so that it installs and uses the Poetry-installed MyPy package instead of re-installing MyPy again somewhere else or under a different version.
For the GitHub CI Workflow, we could just remove the Ruff and isort calls and run pre-commit instead:
poetry run pre-commit run --all-files --show-diff-on-failure
Describe alternatives you've considered N/A
Additional context This has not been done yet because there are currently around 100 MyPy errors to work through first. Otherwise, every CI test would be marked as a failure for a fair while and spam my email about them. Therefore, this should only be implemented once all MyPy errors have been fixed.