Skip to content

Commit e3286d2

Browse files
authored
Mypy type-checking feedback for all "pyre safe" sources. (#801)
Per @moto-meta's recommendation, I've added a pre-commit nudge for mypy: #790 (comment) This configures pre-commit to print all mypy-related type-check failures. Mypy is configured to never fail the pre-commit check, however. This is a useful mechanism to gradually improve type enforcement in the codebase.
1 parent 25ad420 commit e3286d2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,17 @@ repos:
3030
# Run the formatter.
3131
- id: ruff-format
3232
types_or: [ python, pyi ]
33+
34+
# This check is set to never fail, but will print all current mypy failures. See:
35+
# https://stackoverflow.com/a/59745587
36+
- repo: https://github.com/pre-commit/mirrors-mypy
37+
rev: v1.16.1
38+
hooks:
39+
- id: mypy
40+
verbose: true
41+
entry: bash -c
42+
args:
43+
# Call mypy on all files that aren't marked "pyre-unsafe", excluding 'setup.py' files.
44+
- 'mypy $((grep -L "# pyre-unsafe" "$@" 2>/dev/null || printf "%s\n" "$@") | grep -v setup.py) || true'
45+
- --
46+
types_or: [python, pyi]

0 commit comments

Comments
 (0)