diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1c05a65..8a50b48 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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/.* - ) diff --git a/pyproject.toml b/pyproject.toml index fb83c3f..856ca46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/tox.ini b/tox.ini index a45f33a..ebdb708 100644 --- a/tox.ini +++ b/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 =