diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c8c9f25d9..e3f7d939d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,3 +37,46 @@ repos: entry: flake8 files: '^.*\.py$' exclude: '^(doc|releasenotes|tools)/.*$' + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.4.1 + hooks: + - id: mypy + additional_dependencies: + - types-decorator + - types-PyYAML + - types-requests + - types-simplejson + # keep this in-sync with '[mypy] exclude' in 'setup.cfg' + exclude: | + (?x)( + openstack/tests/ansible/.* + | openstack/tests/functional/.* + | openstack/tests/unit/.* + | openstack/tests/fixtures.py + | openstack/accelerator/.* + | openstack/baremetal/.* + | openstack/baremetal_introspection/.* + | openstack/block_storage/.* + | openstack/cloud/.* + | openstack/clustering/.* + | openstack/compute/.* + | openstack/container_infrastructure_management/.* + | openstack/database/.* + | openstack/dns/.* + | openstack/fixture/.* + | openstack/identity/.* + | openstack/image/.* + | openstack/instance_ha/.* + | openstack/key_manager/.* + | openstack/load_balancer/.* + | openstack/message/.* + | openstack/network/.* + | openstack/object_store/.* + | openstack/orchestration/.* + | openstack/placement/.* + | openstack/shared_file_system/.* + | openstack/workflow/.* + | doc/.* + | examples/.* + | releasenotes/.* + ) diff --git a/setup.cfg b/setup.cfg index 2fd433c2e..50074a951 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,3 +28,48 @@ packages = [entry_points] console_scripts = openstack-inventory = openstack.cloud.cmd.inventory:main + +[mypy] +show_column_numbers = true +show_error_context = true +ignore_missing_imports = true +# follow_imports = normal +follow_imports = skip +incremental = true +check_untyped_defs = true +warn_unused_ignores = true +# keep this in-sync with 'mypy.exclude' in '.pre-commit-config.yaml' +# TODO(stephenfin) Eventually we should remove everything here except the +# unit tests module +exclude = (?x)( + openstack/tests/ansible + | openstack/tests/functional + | openstack/tests/unit + | openstack/tests/fixtures.py + | openstack/accelerator + | openstack/baremetal + | openstack/baremetal_introspection + | openstack/block_storage + | openstack/cloud + | openstack/clustering + | openstack/compute + | openstack/container_infrastructure_management + | openstack/database + | openstack/dns + | openstack/fixture + | openstack/identity + | openstack/image + | openstack/instance_ha + | openstack/key_manager + | openstack/load_balancer + | openstack/message + | openstack/network + | openstack/object_store + | openstack/orchestration + | openstack/placement + | openstack/shared_file_system + | openstack/workflow + | doc + | examples + | releasenotes + )