diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 8fda5eb14..61bc67b71 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,7 +1,8 @@ - id: sphinx-lint - name: Sphinx lint - description: 'Searches for common typos in sphinx-flavored rst files.' - files: '\.rst$' + name: Sphinx Lint + description: 'Searches for common problems in Sphinx-flavored reST files' + types: [rst] + # Defer to pre-commit on the best way to delegate resources across available cores + args: [--jobs=1] entry: sphinx-lint language: python - diff --git a/README.md b/README.md index 0cca15ce5..afb5200ee 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ CPython](https://github.com/python/cpython/blob/e0433c1e7/Doc/tools/rstlint.py). ## What is Sphinx Lint, what is it not? -`sphinx-lint` should: +Sphinx Lint should: - be reasonably fast so it's comfortable to use as a linter in your editor. - be usable on a single file. @@ -21,6 +21,29 @@ CPython](https://github.com/python/cpython/blob/e0433c1e7/Doc/tools/rstlint.py). - focus on finding errors that are **not** visible to sphinx-build. +## Using Sphinx Lint + +Here are some example invocations of Sphinx Lint from the command line: + +```sh +sphinx-lint # check all dirs and files +sphinx-lint file.rst # check a single file +sphinx-lint docs # check a directory +sphinx-lint -i venv # ignore a file/directory +sphinx-lint -h # for more options +``` + +Sphinx Lint can also be used via [pre-commit](https://pre-commit.com). +We recommend using a configuration like this: + +```yaml + - repo: https://github.com/sphinx-contrib/sphinx-lint + rev: LATEST_SPHINXLINT_RELEASE_TAG + hooks: + - id: sphinx-lint +``` + + ## Known issues Currently Sphinx Lint can't work with tables, there's no understanding @@ -77,22 +100,21 @@ $ docutils --writer=pseudoxml tests/fixtures/xpass/role-in-code-sample.rst ## Releasing -First test with friends projects by running: - - sh download-more-tests.sh - python -m pytest - -Bump the version in `sphinxlint.py`, commit, tag, push: - - git tag v0.6.5 - git push - git push --tags - -To release on PyPI run: - - python -m pip install --upgrade build twine - python -m build - python -m twine upload dist/* +1. Make sure that the [CI tests pass](https://github.com/sphinx-contrib/sphinx-lint/actions) + and optionally double-check locally with "friends projects" by running: + + sh download-more-tests.sh + python -m pytest +2. Go on the [Releases page](https://github.com/sphinx-contrib/sphinx-lint/releases) +3. Click "Draft a new release" +4. Click "Choose a tag" +5. Type the next vX.Y.Z version and select "Create new tag: vX.Y.Z on publish" +6. Leave the "Release title" blank (it will be autofilled) +7. Click "Generate release notes" and amend as required +8. Click "Publish release" +9. Check the tagged + [GitHub Actions build](https://github.com/sphinx-contrib/sphinx-lint/actions/workflows/deploy.yml) + has [deployed to PyPI](https://pypi.org/project/sphinx-lint/#history) ## License diff --git a/pyproject.toml b/pyproject.toml index ca6cbdb01..5f4d12743 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,8 @@ dynamic = ["version"] [project.urls] -repository = "https://github.com/sphinx-contrib/sphinx-lint" +Repository = "https://github.com/sphinx-contrib/sphinx-lint" +Changelog = "https://github.com/sphinx-contrib/sphinx-lint/releases" [project.scripts] sphinx-lint = "sphinxlint.__main__:main"