Skip to content
Open
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
26 changes: 13 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:

# file checking out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: check-case-conflict
- id: check-shebang-scripts-are-executable
Expand All @@ -49,7 +49,7 @@ repos:

# ruff - python linter with fixing ability
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 76e47323a83cd9795e4ff9a1de1c0d2eef610f17 # frozen: v0.11.11
rev: 9b1e9a33f1b33f6ecc2fdbb8d7cc894e951106e4 # frozen: v0.14.13
hooks:
- id: ruff
name: ruff (fix)
Expand All @@ -59,7 +59,7 @@ repos:

# blacken-docs - black for python code in docs (rst/md/tex)
- repo: https://github.com/asottile/blacken-docs
rev: 78a9dcbecf4f755f65d1f3dec556bc249d723600 # frozen: 1.19.1
rev: dda8db18cfc68df532abf33b185ecd12d5b7b326 # frozen: 1.20.0
hooks:
- id: blacken-docs
args: ["--line-length=100", "--target-version=py312"]
Expand Down Expand Up @@ -104,7 +104,7 @@ repos:

# code unspecific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: end-of-file-fixer
stages: [pre-commit]
Expand Down Expand Up @@ -134,7 +134,7 @@ repos:

# code unspecific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: check-merge-conflict
- id: detect-private-key
Expand All @@ -145,7 +145,7 @@ repos:

# ruff - python linter with fixing ability
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 76e47323a83cd9795e4ff9a1de1c0d2eef610f17 # frozen: v0.11.11
rev: 9b1e9a33f1b33f6ecc2fdbb8d7cc894e951106e4 # frozen: v0.14.13
hooks:
- id: ruff
name: ruff (lint)
Expand All @@ -156,7 +156,7 @@ repos:

# python specific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: debug-statements
- id: fix-encoding-pragma
Expand All @@ -180,7 +180,7 @@ repos:

# pylint - python linter
- repo: https://github.com/PyCQA/pylint/
rev: f798a4a3508bcbb8ad0773ae14bf32d28dcfdcbe # frozen: v3.3.7
rev: e16f942166511d6fb4427e503a734152fae0c4fe # frozen: v4.0.4
hooks:
- id: pylint
name: spell-check (pylint+pyenchant)
Expand All @@ -195,7 +195,7 @@ repos:

# shellscript (via PyPI package)
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: a23f6b85d0fdd5bb9d564e2579e678033debbdff # frozen: v0.10.0.1
rev: 745eface02aef23e168a8afb6b5737818efbea95 # frozen: v0.11.0.1
hooks:
- id: shellcheck

Expand All @@ -205,7 +205,7 @@ repos:

# rstcheck - rst file checker
- repo: https://github.com/rstcheck/rstcheck
rev: f30c4d170a36ea3812bceb5f33004afc213bd797 # frozen: v6.2.4
rev: 27258fde1ee7d3b1e6a7bbc58f4c7b1dd0e719e5 # frozen: v6.2.5
hooks:
- id: rstcheck
additional_dependencies: [sphinx]
Expand All @@ -218,7 +218,7 @@ repos:

# markdownlint - md file checker
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: d7a4f7cf4914d3bffb9b83bdbc45fd2a00c91ff9 # frozen: v0.18.1
rev: 7339935a3036f096ee0d7f1f047a9ec41707d4c1 # frozen: v0.20.0
hooks:
- id: markdownlint-cli2

Expand All @@ -228,13 +228,13 @@ repos:

# JSON specific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: check-toml
- id: check-yaml

# yamllint - yaml linter
- repo: https://github.com/adrienverge/yamllint
rev: 79a6b2b1392eaf49cdd32ac4f14be1a809bbd8f7 # frozen: v1.37.1
rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0
hooks:
- id: yamllint
4 changes: 2 additions & 2 deletions prep_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ def _main() -> int:
if args.first_release:
release_version = "v1.0.0"
#: Get first commit
current_version = subprocess.run( # noqa: S603
current_version = subprocess.run(
["git", "rev-list", "--max-parents=0", "HEAD"], # noqa: S607
check=True,
capture_output=True,
).stdout.decode()[0:7]
else:
git_tags = (
subprocess.run( # noqa: S603
subprocess.run(
["git", "tag", "--list"], # noqa: S607
check=True,
capture_output=True,
Expand Down
40 changes: 19 additions & 21 deletions src/rstcheck_core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ class RstcheckConfigFile(pydantic.BaseModel):
:raises pydantic.ValidationError: If setting is not parsable into correct type
"""

report_level: t.Optional[ReportLevel] = None # noqa: UP007
ignore_directives: t.Optional[t.List[str]] = None # noqa: UP007,UP006
ignore_roles: t.Optional[t.List[str]] = None # noqa: UP007,UP006
ignore_substitutions: t.Optional[t.List[str]] = None # noqa: UP007,UP006
ignore_languages: t.Optional[t.List[str]] = None # noqa: UP007,UP006
ignore_messages: t.Optional[t.Pattern[str]] = None # noqa: UP007
report_level: ReportLevel | None = None
ignore_directives: t.List[str] | None = None # noqa: UP006
ignore_roles: t.List[str] | None = None # noqa: UP006
ignore_substitutions: t.List[str] | None = None # noqa: UP006
ignore_languages: t.List[str] | None = None # noqa: UP006
ignore_messages: t.Pattern[str] | None = None

@pydantic.field_validator("report_level", mode="before")
@classmethod
Expand Down Expand Up @@ -189,9 +189,9 @@ class RstcheckConfig(RstcheckConfigFile):
:raises pydantic.ValidationError: If setting is not parsable into correct type
"""

config_path: t.Optional[pathlib.Path] = None # noqa: UP007
recursive: t.Optional[bool] = None # noqa: UP007
warn_unknown_settings: t.Optional[bool] = None # noqa: UP007
config_path: pathlib.Path | None = None
recursive: bool | None = None
warn_unknown_settings: bool | None = None


class _RstcheckConfigINIFile(pydantic.BaseModel):
Expand All @@ -203,11 +203,11 @@ class _RstcheckConfigINIFile(pydantic.BaseModel):
"""

report_level: t.Union[str, int, None] = None # noqa: UP007
ignore_directives: t.Optional[str] = None # noqa: UP007
ignore_roles: t.Optional[str] = None # noqa: UP007
ignore_substitutions: t.Optional[str] = None # noqa: UP007
ignore_languages: t.Optional[str] = None # noqa: UP007
ignore_messages: t.Optional[str] = None # noqa: UP007
ignore_directives: str | None = None
ignore_roles: str | None = None
ignore_substitutions: str | None = None
ignore_languages: str | None = None
ignore_messages: str | None = None


def _load_config_from_ini_file(
Expand Down Expand Up @@ -281,10 +281,10 @@ class _RstcheckConfigTOMLFile(pydantic.BaseModel):
"""

report_level: t.Union[str, int, None] = None # noqa: UP007
ignore_directives: t.Optional[t.List[str]] = None # noqa: UP006, UP007
ignore_roles: t.Optional[t.List[str]] = None # noqa: UP006, UP007
ignore_substitutions: t.Optional[t.List[str]] = None # noqa: UP006, UP007
ignore_languages: t.Optional[t.List[str]] = None # noqa: UP006, UP007
ignore_directives: t.List[str] | None = None # noqa: UP006
ignore_roles: t.List[str] | None = None # noqa: UP006
ignore_substitutions: t.List[str] | None = None # noqa: UP006
ignore_languages: t.List[str] | None = None # noqa: UP006
ignore_messages: t.Union[t.List[str], str, None] = None # noqa: UP006, UP007


Expand Down Expand Up @@ -334,9 +334,7 @@ def _load_config_from_toml_file(
with pathlib.Path(resolved_file).open("rb") as toml_file_handle:
toml_dict = tomllib.load(toml_file_handle)

rstcheck_section: t.Optional[dict[str, t.Any]] = toml_dict.get("tool", {}).get( # noqa: UP007
"rstcheck"
)
rstcheck_section: dict[str, t.Any] | None = toml_dict.get("tool", {}).get("rstcheck")

if rstcheck_section is None:
if log_missing_section_as_warning:
Expand Down
Loading