Merge "pre-commit: Add mypy"
This commit is contained in:
+35
-1
@@ -40,4 +40,38 @@ repos:
|
||||
rev: v2.2.4
|
||||
hooks:
|
||||
- id: codespell
|
||||
args: ['--ignore-words=doc/dictionary.txt']
|
||||
args: ['--ignore-words=doc/dictionary.txt']
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.4.1
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies:
|
||||
- types-paramiko
|
||||
# keep this in-sync with '[mypy] files' in 'setup.cfg'
|
||||
files: |
|
||||
(?x)(
|
||||
nova/compute/manager.py
|
||||
| nova/compute/pci_placement_translator.py
|
||||
| nova/crypto.py
|
||||
| nova/filesystem.py
|
||||
| nova/limit/local.py
|
||||
| nova/limit/placement.py
|
||||
| nova/network/neutron.py
|
||||
| nova/pci
|
||||
| nova/privsep/path.py
|
||||
| nova/scheduler/client/report.py
|
||||
| nova/scheduler/request_filter.py
|
||||
| nova/scheduler/utils.py
|
||||
| nova/virt/driver.py
|
||||
| nova/virt/hardware.py
|
||||
| nova/virt/libvirt/machine_type_utils.py
|
||||
| nova/virt/libvirt/__init__.py
|
||||
| nova/virt/libvirt/cpu/__init__.py
|
||||
| nova/virt/libvirt/cpu/api.py
|
||||
| nova/virt/libvirt/cpu/core.py
|
||||
| nova/virt/libvirt/driver.py
|
||||
| nova/virt/libvirt/event.py
|
||||
| nova/virt/libvirt/guest.py
|
||||
| nova/virt/libvirt/host.py
|
||||
| nova/virt/libvirt/utils.py
|
||||
)
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
nova/compute/manager.py
|
||||
nova/compute/pci_placement_translator.py
|
||||
nova/crypto.py
|
||||
nova/filesystem.py
|
||||
nova/limit/local.py
|
||||
nova/limit/placement.py
|
||||
nova/network/neutron.py
|
||||
nova/pci
|
||||
nova/privsep/path.py
|
||||
nova/scheduler/client/report.py
|
||||
nova/scheduler/request_filter.py
|
||||
nova/scheduler/utils.py
|
||||
nova/virt/driver.py
|
||||
nova/virt/hardware.py
|
||||
nova/virt/libvirt/machine_type_utils.py
|
||||
nova/virt/libvirt/__init__.py
|
||||
nova/virt/libvirt/cpu/__init__.py
|
||||
nova/virt/libvirt/cpu/api.py
|
||||
nova/virt/libvirt/cpu/core.py
|
||||
nova/virt/libvirt/driver.py
|
||||
nova/virt/libvirt/event.py
|
||||
nova/virt/libvirt/guest.py
|
||||
nova/virt/libvirt/host.py
|
||||
nova/virt/libvirt/utils.py
|
||||
@@ -101,8 +101,33 @@ follow_imports = skip
|
||||
incremental = true
|
||||
check_untyped_defs = true
|
||||
warn_unused_ignores = true
|
||||
files =
|
||||
nova/compute/manager.py,
|
||||
nova/compute/pci_placement_translator.py,
|
||||
nova/crypto.py,
|
||||
nova/filesystem.py,
|
||||
nova/limit/local.py,
|
||||
nova/limit/placement.py,
|
||||
nova/network/neutron.py,
|
||||
nova/pci/*.py,
|
||||
nova/privsep/path.py,
|
||||
nova/scheduler/client/report.py,
|
||||
nova/scheduler/request_filter.py,
|
||||
nova/scheduler/utils.py,
|
||||
nova/virt/driver.py,
|
||||
nova/virt/hardware.py,
|
||||
nova/virt/libvirt/machine_type_utils.py,
|
||||
nova/virt/libvirt/__init__.py,
|
||||
nova/virt/libvirt/cpu/__init__.py,
|
||||
nova/virt/libvirt/cpu/api.py,
|
||||
nova/virt/libvirt/cpu/core.py,
|
||||
nova/virt/libvirt/driver.py,
|
||||
nova/virt/libvirt/event.py,
|
||||
nova/virt/libvirt/guest.py,
|
||||
nova/virt/libvirt/host.py,
|
||||
nova/virt/libvirt/utils.py
|
||||
|
||||
[codespell]
|
||||
skip = *.po,*.js,*.css,*.html,*.svg,HACKING.py,*hacking*,*build*,*_static*,doc/dictionary.txt,*.pyc,*.inv,*.gz,*.jpg,*.png,*.vsd,*.graffle,*.json
|
||||
count =
|
||||
quiet-level = 4
|
||||
quiet-level = 4
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
hacking==6.1.0 # Apache-2.0
|
||||
mypy>=0.761 # MIT
|
||||
types-paramiko>=0.1.3 # Apache-2.0
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
ddt>=1.2.1 # MIT
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# A wrapper around mypy that allows us to specify what files to run 'mypy' type
|
||||
# checks on. Intended to be invoked via tox:
|
||||
#
|
||||
# tox -e mypy
|
||||
#
|
||||
# Eventually this should go away once we have either converted everything or
|
||||
# converted enough and ignored [1] the rest.
|
||||
#
|
||||
# [1] http://mypy.readthedocs.io/en/latest/config_file.html#per-module-flags
|
||||
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
# if no arguments provided, use the standard converted lists
|
||||
lines=$(grep -v '#' $ROOT_DIR/../mypy-files.txt)
|
||||
python -m mypy ${lines[@]}
|
||||
else
|
||||
# else test what the user asked us to
|
||||
python -m mypy $@
|
||||
fi
|
||||
@@ -99,14 +99,6 @@ extras =
|
||||
commands =
|
||||
stestr --test-path=./nova/tests/functional run --exclude-regex '((?:api|notification)_sample_tests|functional\.db\.)' {posargs}
|
||||
|
||||
[testenv:mypy]
|
||||
description =
|
||||
Run type checks.
|
||||
envdir = {toxworkdir}/shared
|
||||
extras =
|
||||
commands =
|
||||
bash tools/mypywrap.sh {posargs}
|
||||
|
||||
[testenv:pep8]
|
||||
description =
|
||||
Run style checks.
|
||||
@@ -116,6 +108,15 @@ extras =
|
||||
commands =
|
||||
pre-commit run --all-files --show-diff-on-failure
|
||||
|
||||
[testenv:mypy]
|
||||
description =
|
||||
Run type checks.
|
||||
deps =
|
||||
pre-commit
|
||||
extras =
|
||||
commands =
|
||||
pre-commit run --all-files --show-diff-on-failure mypy
|
||||
|
||||
[testenv:autopep8]
|
||||
extras =
|
||||
deps =
|
||||
|
||||
Reference in New Issue
Block a user