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 docs on how best to use sphinx-lint with pre-commit #90

Merged
merged 4 commits into from
Oct 13, 2023
Merged
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
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,37 @@ 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

To use Sphinx Lint, run:

```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
args: [--jobs=1]
types: [rst]
```

In particular, note that the `--jobs=1` flag is recommended for use with pre-commit.
By default, Sphinx Lint uses `multiprocessing` to lint multiple files simultaneously,
but this interacts poorly with pre-commit, which also attempts to use multiprocessing,
leading to resource contention. Adding `--jobs=1` tells Sphinx Lint not to use
multiprocessing itself, deferring to pre-commit on the best way to delegate resources
across available cores.


## Known issues

Currently Sphinx Lint can't work with tables, there's no understanding
Expand Down