diff --git a/.gitignore b/.gitignore index 556e3130..1b5882e5 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,6 @@ secrets.tar src/*/_setuptools_scm_version.txt uv.lock + +# Vale styles downloaded by ``vale sync`` +styles/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0cd0ac39..4171919a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -288,6 +288,33 @@ repos: - *uv_version stages: [pre-commit] + # Vale enforces prose style rules, such as banning em dashes, in + # reStructuredText files. + # The rules come from the ``ClearProse`` package pinned in ``.vale.ini``, + # which ``vale sync`` downloads into the (gitignored) ``styles`` + # directory. + # Vale needs ``rst2html`` from Docutils on the ``PATH`` to parse + # reStructuredText. + - id: vale-sync + name: vale sync + entry: uv run --extra=dev vale sync + language: python + pass_filenames: false + types_or: [rst] + additional_dependencies: + - *uv_version + stages: [pre-commit] + + - id: vale + name: vale + entry: uv run --extra=dev vale + language: python + types_or: [rst] + require_serial: true + additional_dependencies: + - *uv_version + stages: [pre-commit] + - id: interrogate name: interrogate entry: uv run --extra=dev -m interrogate diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 00000000..8e3f9f74 --- /dev/null +++ b/.vale.ini @@ -0,0 +1,7 @@ +StylesPath = styles +MinAlertLevel = error + +Packages = https://github.com/adamtheturtle/vale-style-clear-prose/releases/download/v1.1.0/ClearProse.zip + +[*.rst] +BasedOnStyles = ClearProse diff --git a/pyproject.toml b/pyproject.toml index 0410a509..0d6cf82b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,6 +84,7 @@ optional-dependencies.dev = [ "towncrier==25.8.0", "ty==0.0.65", "types-requests==2.33.0.20260712", + "vale==3.13.0.0", "vulture==2.16", "vws-python-mock==2026.8.4.2", "vws-test-fixtures==2023.3.5", @@ -286,6 +287,7 @@ ignore = [ ".git_archival.txt", ".pre-commit-config.yaml", ".prettierrc", + ".vale.ini", ".yamlfmt", "CHANGELOG.rst", "ci",