Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify types #1028

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ repos:
language: python
types_or: [markdown, rst]

- id: pyright-verifytypes
name: pyright-verifytypes
stages: [pre-push]
# Use `--ignoreexternal` because we expose parts of the Sphinx API and Sphinx is not
# thoroughly typed enough.
entry: uv run --extra=dev -m pyright --ignoreexternal --verifytypes sphinx_substitution_extensions
language: python
pass_filenames: false
types_or: [python]
additional_dependencies: [uv==0.4.25]

- id: vulture
name: vulture
entry: uv run --extra=dev -m vulture .
Expand Down Expand Up @@ -237,6 +248,7 @@ ci:
- pyproject-fmt-fix
- pyright
- pyright-docs
- pyright-verifytypes
- pyroma
- ruff-check-fix
- ruff-check-fix-docs
Expand Down
4 changes: 2 additions & 2 deletions src/sphinx_substitution_extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from sphinx.directives.code import CodeBlock
from sphinx.environment import BuildEnvironment
from sphinx.roles import XRefRole
from sphinx.util.typing import ExtensionMetadata
from sphinx.util.typing import ExtensionMetadata, OptionSpec

from sphinx_substitution_extensions.shared import (
SUBSTITUTION_OPTION_NAME,
Expand All @@ -29,7 +29,7 @@ class SubstitutionCodeBlock(CodeBlock):
Similar to CodeBlock but replaces placeholders with variables.
"""

option_spec = CodeBlock.option_spec
option_spec: ClassVar[OptionSpec] = CodeBlock.option_spec
option_spec["substitutions"] = directives.flag

def run(self) -> list[Node]:
Expand Down
Loading