diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b4079be4..6ea1ff68 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,3 +24,16 @@ repos: - id: ruff-check args: ['--fix', '--unsafe-fixes'] - id: ruff-format + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.17.1 + hooks: + - id: mypy + additional_dependencies: [ + 'dogpile.cache', + ] + # keep this in-sync with '[tool.mypy] exclude' in 'pyproject.toml' + exclude: | + (?x)( + doc/.* + | releasenotes/.* + ) diff --git a/pyproject.toml b/pyproject.toml index 2ce74955..f0c52956 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,3 +69,40 @@ ignore = [ [tool.ruff.lint.per-file-ignores] "oslo_cache/tests/*" = ["S"] + +[tool.mypy] +python_version = "3.10" +show_column_numbers = true +show_error_context = true +ignore_missing_imports = true +follow_imports = "normal" +check_untyped_defs = true +warn_unused_ignores = false +warn_return_any = true +warn_unused_configs = true +warn_redundant_casts = true +strict_equality = true +disallow_untyped_decorators = true +disallow_any_generics = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_reexport = true +extra_checks = true +# keep this in-sync with 'mypy.exclude' in '.pre-commit-config.yaml' +exclude = ''' +(?x)( + doc + | releasenotes + ) +''' + +[[tool.mypy.overrides]] +module = ["oslo_cache.tests.*"] +warn_return_any = false +disallow_untyped_decorators = false +disallow_any_generics = false +disallow_subclassing_any = false +disallow_untyped_calls = false +disallow_untyped_defs = false