Skip to content

Commit

Permalink
Apply assorted repo-review rules (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri authored Aug 8, 2024
2 parents 44a316a + 883ea41 commit 056262f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
15 changes: 14 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
6 changes: 4 additions & 2 deletions src/validate_pyproject/_tomllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/validate_pyproject/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <pypa:dependency-specifiers>`
Expand Down

0 comments on commit 056262f

Please sign in to comment.