pre-commit: Enable mypy

Change-Id: I8ef122d9aa292758bacf349d964ef7cb5bbed288
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2025-02-19 20:12:33 +00:00
parent 2fd1e26a7b
commit a396fcc05a
2 changed files with 49 additions and 0 deletions

View File

@@ -34,3 +34,18 @@ repos:
additional_dependencies:
- flake8-import-order~=0.18.2
exclude: '^(doc|releasenotes|tools)/.*$'
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies:
- cliff
- keystoneauth1
- types-requests
# keep this in-sync with '[mypy] exclude' in 'setup.cfg'
exclude: |
(?x)(
doc/.*
| examples/.*
| releasenotes/.*
)

View File

@@ -1,3 +1,37 @@
[tool.mypy]
python_version = "3.9"
show_column_numbers = true
show_error_context = true
ignore_missing_imports = true
follow_imports = "normal"
check_untyped_defs = true
warn_unused_ignores = true
warn_return_any = false
warn_unused_configs = true
warn_redundant_casts = true
strict_equality = true
disallow_untyped_decorators = true
disallow_any_generics = true
# TODO(stephenfin): Change this once we've fully typed everything
disallow_subclassing_any = false
disallow_untyped_calls = false
disallow_incomplete_defs = true
disallow_untyped_defs = false
no_implicit_reexport = true
extra_checks = true
# keep this in-sync with 'mypy.exclude' in '.pre-commit-config.yaml'
exclude = '''
(?x)(
doc
| examples
| releasenotes
)
'''
[[tool.mypy.overrides]]
module = ["osc_lib.tests.*"]
ignore_errors = true
[tool.ruff]
line-length = 79