Add mypy pre-commit hook

Change-Id: Idbac0310d7bdc90db8021c0b01c936cff26111de
This commit is contained in:
Federico Ressi 2020-07-03 07:49:05 +02:00
parent cecb2b1cde
commit 7b22fc3468
3 changed files with 19 additions and 4 deletions

View File

@ -25,6 +25,16 @@ repos:
additional_dependencies: [flake8-import-order] additional_dependencies: [flake8-import-order]
files: ^tobiko/ files: ^tobiko/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.782'
hooks:
- id: mypy
files: ^tobiko/
entry: mypy tobiko/
pass_filenames: false
# args: [--ignore-missing-imports]
# - repo: https://github.com/adrienverge/yamllint.git # - repo: https://github.com/adrienverge/yamllint.git
# rev: v1.23.0 # rev: v1.23.0
# hooks: # hooks:

View File

@ -1,8 +1,5 @@
# pep8 and flake8 requirements # pep8 and flake8 requirements
ansible-lint==4.2.0 # MIT ansible-lint==4.2.0 # MIT
flake8>=3.8.1 # MIT
flake8-import-order==0.12 # LGPLv3
mypy>=0.740 # MIT
pre-commit >= 2.6.0 # MIT pre-commit >= 2.6.0 # MIT
pylint>=2.5.2 # GPLv2 pylint>=2.5.2 # GPLv2

10
tox.ini
View File

@ -79,6 +79,15 @@ commands =
pre-commit run -a flake8 pre-commit run -a flake8
[testenv:mypy]
basepython = {[testenv:pep8]basepython}
deps = {[testenv:pep8]deps}
envdir = {toxworkdir}/pep8
commands =
pre-commit run -a mypy
[testenv:pylint] [testenv:pylint]
basepython = {[testenv:pep8]basepython} basepython = {[testenv:pep8]basepython}
deps = {[testenv:pep8]deps} deps = {[testenv:pep8]deps}
@ -97,7 +106,6 @@ envdir = {toxworkdir}/pep8
commands = commands =
pre-commit run -a pre-commit run -a
pre-commit install pre-commit install
mypy --ignore-missing-imports tobiko/
# Ansible lint # Ansible lint
# [ANSIBLE0012] Commands should not change things if nothing needs doing # [ANSIBLE0012] Commands should not change things if nothing needs doing
bash -c 'find roles infrared_plugin/roles -maxdepth 1 -mindepth 1 -type d | \ bash -c 'find roles infrared_plugin/roles -maxdepth 1 -mindepth 1 -type d | \