diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 56dd1e1..85d48fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,12 +32,19 @@ repos: args: [--fix, --show-fixes] - id: ruff-format -- repo: https://github.com/asottile/blacken-docs +- repo: https://github.com/adamchainz/blacken-docs rev: 1.18.0 hooks: - id: blacken-docs additional_dependencies: [black==23.*] +- repo: https://github.com/pre-commit/pygrep-hooks + rev: "v1.10.0" + hooks: + - id: rst-backticks + - id: rst-directive-colons + - id: rst-inline-touching-normal + - repo: local # self-test for `validate-pyproject` hook hooks: - id: validate-pyproject @@ -62,3 +69,9 @@ repos: files: \.schema\.json$ - id: check-readthedocs - id: check-github-workflows + +- repo: https://github.com/scientific-python/cookie + rev: 2024.04.23 + hooks: + - id: sp-repo-review + name: Validate Python repository diff --git a/pyproject.toml b/pyproject.toml index 5ffa9ee..caa4ab9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,9 @@ norecursedirs = ["dist", "build", ".tox"] testpaths = ["src", "tests"] [tool.mypy] +enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] show_traceback = true +warn_unreachable = true strict = true # Scaling back on some of the strictness for now disallow_any_generics = false @@ -86,3 +88,6 @@ disallow_subclassing_any = false [[tool.mypy.overrides]] module = ["fastjsonschema"] ignore_missing_imports = true + +[tool.repo-review] +ignore = ["PP302", "PP304", "PP305", "PP306", "PP308", "PP309", "PC140", "PC180", "PC901"] diff --git a/src/validate_pyproject/_tomllib.py b/src/validate_pyproject/_tomllib.py index 25109f9..6b6fb0a 100644 --- a/src/validate_pyproject/_tomllib.py +++ b/src/validate_pyproject/_tomllib.py @@ -7,8 +7,10 @@ from tomli import TOMLDecodeError, loads except ImportError: # pragma: no cover try: - from toml import TomlDecodeError as TOMLDecodeError # type: ignore - from toml import loads # type: ignore + from toml import ( # type: ignore[no-redef,import-untyped] + TomlDecodeError as TOMLDecodeError, + ) + from toml import loads # type: ignore[no-redef] except ImportError as ex: raise ImportError("Please install `tomli` (TOML parser)") from ex diff --git a/src/validate_pyproject/formats.py b/src/validate_pyproject/formats.py index 9f97e39..153b1f0 100644 --- a/src/validate_pyproject/formats.py +++ b/src/validate_pyproject/formats.py @@ -83,7 +83,9 @@ def pep508_identifier(name: str) -> bool: from packaging import requirements as _req except ImportError: # pragma: no cover # let's try setuptools vendored version - from setuptools._vendor.packaging import requirements as _req # type: ignore + from setuptools._vendor.packaging import ( # type: ignore[no-redef] + requirements as _req, + ) def pep508(value: str) -> bool: """See :ref:`PyPA's dependency specifiers `