Skip to content

Commit cd212d3

Browse files
committed
Adjust configuration mypy
The strict flag enables the following flags (the precise list depends on the mypy version, see mypy --help): --warn-unused-configs, --disallow-any-generics, --disallow-subclassing-any, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete-defs, --check-untyped-defs, --disallow-untyped-decorators, --warn-redundant-casts, --warn-unused-ignores, --warn-return-any, --no-implicit-reexport, --strict-equality, --extra-checks This means mypy accepts the following code as valid: ``` import typing def ignore_without_code() -> int: return "a" # type: ignore def redundant_expr(x: int) -> int: return 1 if isinstance(x, int) else 2 def possible_undefined(x: int) -> int: if x > 0: result = 1 return result def any_explicit(_x: typing.Any) -> None: pass def any_expr() -> None: a = x # type: ignore[name-defined] ```
1 parent 3140291 commit cd212d3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ build-backend = "poetry.core.masonry.api"
2525

2626
[tool.mypy]
2727
strict = true
28+
enable_error_code = [
29+
"ignore-without-code",
30+
"redundant-expr",
31+
"possibly-undefined",
32+
]
33+
disallow_any_expr = true
34+
disallow_any_explicit = true
35+
2836

2937
[tool.isort]
3038
profile = "black"

0 commit comments

Comments
 (0)