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

Add more pre-commit hooks #954

Merged
merged 7 commits into from
Oct 8, 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
2 changes: 2 additions & 0 deletions .checkmake-config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[minphony]
disabled = true
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -215,6 +238,7 @@ ci:
- ruff-check-fix-docs
- ruff-format-fix
- ruff-format-fix-docs
- docformatter
- shellcheck
- shellcheck-docs
- shfmt
Expand Down
5 changes: 5 additions & 0 deletions .yamlfmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
formatter:
include_document_start: true
retain_line_breaks_single: true
trim_trailing_whitespace: true
end_of_file_newline: true
1 change: 1 addition & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
coverage:
status:
patch:
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 = [
Expand Down
4 changes: 3 additions & 1 deletion sample/source/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
"""Documentation."""
"""
Documentation.
"""
8 changes: 6 additions & 2 deletions src/sphinx_substitution_extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Configuration for pytest."""
"""
Configuration for pytest.
"""

import pytest
from beartype import beartype
Expand Down
3 changes: 1 addition & 2 deletions tests/test_substitution_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down