Enable mypy pre-commit hook

Change-Id: I266a2866627fcf66d0f5111c9237a37e55414685
This commit is contained in:
Ihar Hrachyshka 2025-01-09 18:10:01 -05:00
parent 9127c121da
commit 434ef3018e
3 changed files with 13 additions and 1 deletions

View File

@ -47,6 +47,16 @@ repos:
- id: hacking - id: hacking
additional_dependencies: ['neutron', 'neutron-lib'] additional_dependencies: ['neutron', 'neutron-lib']
exclude: '^(doc|releasenotes|tools)/.*$' exclude: '^(doc|releasenotes|tools)/.*$'
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
args: [--config-file=./mypy.ini]
pass_filenames: false
# need to list alembic here; otherwise it doesn't see internals
# necessary to detect one of 'ignored' errors and complains about
# unnecessary ignore; other dependencies can be left out it seems
additional_dependencies: ['alembic']
- repo: local - repo: local
hooks: hooks:
- id: flake8 - id: flake8

View File

@ -12,6 +12,8 @@ disable_error_code = import-untyped,var-annotated,import-not-found
# honor excludes by not following there through imports # honor excludes by not following there through imports
follow_imports = silent follow_imports = silent
files = neutron
# NOTE: Gradually enable type checking for each package. # NOTE: Gradually enable type checking for each package.
# Finally, when the whole repo is migrated this option can be deleted # Finally, when the whole repo is migrated this option can be deleted
# and rules applied to the whole repo. # and rules applied to the whole repo.

View File

@ -123,7 +123,7 @@ commands =
[testenv:mypy] [testenv:mypy]
deps = {[testenv:pep8]deps} deps = {[testenv:pep8]deps}
commands = mypy --config-file ./mypy.ini neutron commands = mypy --config-file ./mypy.ini
[testenv:releasenotes] [testenv:releasenotes]
description = description =