diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 69e316a..03f04a1 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -191,6 +191,15 @@ # for backward compatibility files: '' minimum_pre_commit_version: 0.15.0 +- id: mypy + name: mypy + description: This hook runs mypy. + entry: mypy + language: python + types: [python] + # for backward compatibility + files: '' + minimum_pre_commit_version: 0.15.0 - id: name-tests-test name: Tests should end in _test.py description: This verifies that test files are named correctly diff --git a/README.md b/README.md index 8113736..4b1a046 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,9 @@ Add this to your `.pre-commit-config.yaml` - `file-contents-sorter` - Sort the lines in specified files (defaults to alphabetical). You must provide list of target files as input to it. Note that this hook WILL remove blank lines and does NOT respect any comments. - `flake8` - Run flake8 on your python files. - `forbid-new-submodules` - Prevent addition of new git submodules. +- `mypy` - Run mypy on your python files. + - Use `files: ^my_package/.+\.py$` to exclude test and other files from being checked. + - Use `args: ['--config-file', 'mypy-pre-commit.ini']` to use a custom mypy configuration for this pre-commit hook. - `name-tests-test` - Assert that files in tests/ end in `_test.py`. - Use `args: ['--django']` to match `test*.py` instead. - `no-commit-to-branch` - Protect specific branches from direct checkins.