Run mypy from tox
This avoids the need to duplicate our dependency list in multiple places and allows us to take advantage of tox's dependency management infrastructure, to ensure we always get the latest and greatest version of a package allowed by upper-constraints. It also removes the slowest pre-commit hook (by some distance), making pre-commit faster. While here, we also enable some more rules for ruff and configure hacking as an external linter. Change-Id: I47e34c34003273146e4afbef74385ca91fb28823 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
@@ -13,26 +13,8 @@ repos:
|
||||
- id: check-yaml
|
||||
files: .*\.(yaml|yml)$
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.14.5
|
||||
rev: v0.15.5
|
||||
hooks:
|
||||
- id: ruff-check
|
||||
args: ['--fix', '--unsafe-fixes']
|
||||
- id: ruff-format
|
||||
- repo: https://opendev.org/openstack/hacking
|
||||
rev: 8.0.0
|
||||
hooks:
|
||||
- id: hacking
|
||||
additional_dependencies: []
|
||||
exclude: '^(doc|releasenotes|tools)/.*$'
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.18.2
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies:
|
||||
- types-WebOb
|
||||
# keep this in-sync with '[mypy] exclude' in 'pyproject.toml'
|
||||
exclude: |
|
||||
(?x)(
|
||||
doc/.*
|
||||
| releasenotes/.*
|
||||
)
|
||||
|
||||
@@ -40,13 +40,8 @@ python_version = "3.10"
|
||||
show_column_numbers = true
|
||||
show_error_context = true
|
||||
strict = true
|
||||
# keep this in-sync with 'mypy.exclude' in '.pre-commit-config.yaml'
|
||||
exclude = '''
|
||||
(?x)(
|
||||
doc
|
||||
| releasenotes
|
||||
)
|
||||
'''
|
||||
disable_error_code = ["import-untyped"]
|
||||
exclude = "(?x)(doc | releasenotes)"
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = ["microversion_parse.tests.*"]
|
||||
@@ -62,7 +57,8 @@ quote-style = "single"
|
||||
docstring-code-format = true
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["E4", "E5", "E7", "E9", "F", "S", "UP"]
|
||||
select = ["E4", "E5", "E7", "E9", "F", "G", "LOG", "S", "UP"]
|
||||
external = ["H"]
|
||||
ignore = [
|
||||
# we only use asserts for type narrowing
|
||||
"S101",
|
||||
|
||||
19
tox.ini
19
tox.ini
@@ -17,12 +17,23 @@ commands = {posargs}
|
||||
|
||||
[testenv:pep8]
|
||||
description =
|
||||
Run style checks.
|
||||
skip_install = true
|
||||
Run style checks.
|
||||
deps =
|
||||
pre-commit
|
||||
pre-commit
|
||||
{[testenv:mypy]deps}
|
||||
commands =
|
||||
pre-commit run --all-files --show-diff-on-failure
|
||||
pre-commit run -a
|
||||
{[testenv:mypy]commands}
|
||||
|
||||
[testenv:mypy]
|
||||
description =
|
||||
Run type checks.
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
mypy
|
||||
types-WebOb
|
||||
commands =
|
||||
mypy --cache-dir="{envdir}/mypy_cache" {posargs:microversion_parse}
|
||||
|
||||
[testenv:cover]
|
||||
description =
|
||||
|
||||
Reference in New Issue
Block a user