Browse Source

Add mypy pre-commit hook

Change-Id: Idbac0310d7bdc90db8021c0b01c936cff26111de
changes/65/739165/4
Federico Ressi 1 year ago
parent
commit
7b22fc3468
  1. 10
      .pre-commit-config.yaml
  2. 3
      linters-requirements.txt
  3. 10
      tox.ini

10
.pre-commit-config.yaml

@ -25,6 +25,16 @@ repos:
additional_dependencies: [flake8-import-order]
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
# rev: v1.23.0
# hooks:

3
linters-requirements.txt

@ -1,8 +1,5 @@
# pep8 and flake8 requirements
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
pylint>=2.5.2 # GPLv2

10
tox.ini

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

Loading…
Cancel
Save