在 python 项目中,我有 pre-commit-config.yaml 和黑色和 mypy 检查器。目标是在检查错误之前先运行 black 。和 mypy ./ 修复可能的错误,然后运行钩子。
- repo: local
hooks:
- id: code-formatter
exclude: .pre-commit-config.yaml
name: Format code
entry: black .
language: python
- id: mypy
exclude: .pre-commit-config.yaml
name: Check types
entry: mypy --scripts-are-modules ./
language: python