diff --git a/.checkmake-config.ini b/.checkmake-config.ini new file mode 100644 index 00000000..f2ac3c91 --- /dev/null +++ b/.checkmake-config.ini @@ -0,0 +1,2 @@ +[minphony] +disabled = true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3e669854..170e2cfa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,6 +23,22 @@ repos: - id: file-contents-sorter files: spelling_private_dict\.txt$ - id: trailing-whitespace + - repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.10.0 + hooks: + - id: rst-directive-colons + - id: rst-inline-touching-normal + - id: text-unicode-replacement-char + - id: rst-backticks + - repo: https://github.com/mrtazz/checkmake.git + rev: 0.2.2 + hooks: + - id: checkmake + args: ["--config", ".checkmake-config.ini"] + - repo: https://github.com/google/yamlfmt + rev: v0.13.0 + hooks: + - id: yamlfmt - repo: local hooks: - id: actionlint @@ -33,6 +49,13 @@ repos: types_or: [yaml] additional_dependencies: ["uv"] + - id: docformatter + name: docformatter + entry: uv run --extra=dev -m docformatter --in-place + language: python + types_or: [python] + additional_dependencies: ["uv"] + - id: shellcheck name: shellcheck entry: uv run --extra=dev shellcheck --shell=bash --exclude=SC1017 @@ -215,6 +238,7 @@ ci: - ruff-check-fix-docs - ruff-format-fix - ruff-format-fix-docs + - docformatter - shellcheck - shellcheck-docs - shfmt diff --git a/.yamlfmt b/.yamlfmt new file mode 100644 index 00000000..fbb6dd43 --- /dev/null +++ b/.yamlfmt @@ -0,0 +1,5 @@ +formatter: + include_document_start: true + retain_line_breaks_single: true + trim_trailing_whitespace: true + end_of_file_newline: true diff --git a/codecov.yaml b/codecov.yaml index 93528e93..3be33a8e 100644 --- a/codecov.yaml +++ b/codecov.yaml @@ -1,3 +1,4 @@ +--- coverage: status: patch: diff --git a/pyproject.toml b/pyproject.toml index 7d7fb27c..16cebe87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,7 @@ optional-dependencies.dev = [ "deptry==0.20.0", "doc8==1.1.2", "doccmd==2024.10.8.12", + "docformatter==1.7.5", "interrogate==1.7.0", "mypy==1.11.2", "myst-parser==4.0.0", @@ -232,6 +233,9 @@ spelling-private-dict-file = 'spelling_private_dict.txt' # --spelling-private-dict-file option instead of raising a message. spelling-store-unknown-words = 'no' +[tool.docformatter] +make-summary-multi-line = true + [tool.check-manifest] ignore = [ diff --git a/sample/source/__init__.py b/sample/source/__init__.py index 535ceb2e..b63eed5f 100644 --- a/sample/source/__init__.py +++ b/sample/source/__init__.py @@ -1 +1,3 @@ -"""Documentation.""" +""" +Documentation. +""" diff --git a/src/sphinx_substitution_extensions/__init__.py b/src/sphinx_substitution_extensions/__init__.py index cac48371..240b4865 100644 --- a/src/sphinx_substitution_extensions/__init__.py +++ b/src/sphinx_substitution_extensions/__init__.py @@ -74,7 +74,9 @@ def run(self) -> list[Node]: @beartype class SubstitutionCodeRole: - """Custom role for substitution code.""" + """ + Custom role for substitution code. + """ options: ClassVar[dict[str, Any]] = { "class": directives.class_option, @@ -115,7 +117,9 @@ def __call__( # pylint: disable=dangerous-default-value @beartype class SubstitutionXRefRole(XRefRole): - """Custom role for XRefs.""" + """ + Custom role for XRefs. + """ def process_link( self, diff --git a/tests/conftest.py b/tests/conftest.py index 797fcf50..831e6e04 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,6 @@ -"""Configuration for pytest.""" +""" +Configuration for pytest. +""" import pytest from beartype import beartype diff --git a/tests/test_substitution_extensions.py b/tests/test_substitution_extensions.py index 38554aa8..0941e38c 100644 --- a/tests/test_substitution_extensions.py +++ b/tests/test_substitution_extensions.py @@ -197,8 +197,7 @@ def test_substitution_download( ) -> None: """ The ``substitution-download`` role replaces the placeholders defined in - ``conf.py`` as specified in both the download text and the download - target. + ``conf.py`` as specified in both the download text and the download target. """ source_directory = tmp_path / "source" source_directory.mkdir()