It is a simple pre-commit plug-in that helps you check type hints in committed python files. Currently, only python is supported
It can help you filter folders that you don't want to check, like tests, pytests...
It helps you filter function and method names that you don't want to check, such as get, post, put, and delete in Django view
By default, the plug-in checks type-hints that are not filled in, breaking the commit code and telling you where there is a problem. If you don't want to interrupt the commit, you can enable --ignore, which will only prompt warnings
pip install pre-commit
pip install check-type-hints
Add file .pre-commit-config.yaml to the project root directory. eg:
repos:
- repo: local
hooks:
- id: typehint-check
name: Typehint Check
entry: check_type_hints check --no-ignore --filter tests --filter pytests --method get --method post --method put --method patch --method delete
language: system
types: [ python ]
stages: [ commit ]
pass_filenames: false
verbose: truepre-commit install
You can enjoy it!