Skip to content

Commit dbccac0

Browse files
AlexWaygoodhugovk
andauthored
Improve usability of Sphinx Lint with pre-commit (#94)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 84d17a7 commit dbccac0

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

.pre-commit-hooks.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
- id: sphinx-lint
2-
name: Sphinx lint
3-
description: 'Searches for common typos in sphinx-flavored rst files.'
4-
files: '\.rst$'
2+
name: Sphinx Lint
3+
description: 'Searches for common problems in Sphinx-flavored reST files'
4+
types: [rst]
5+
# Defer to pre-commit on the best way to delegate resources across available cores
6+
args: [--jobs=1]
57
entry: sphinx-lint
68
language: python
7-

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CPython](https://github.com/python/cpython/blob/e0433c1e7/Doc/tools/rstlint.py).
1212

1313
## What is Sphinx Lint, what is it not?
1414

15-
`sphinx-lint` should:
15+
Sphinx Lint should:
1616

1717
- be reasonably fast so it's comfortable to use as a linter in your editor.
1818
- be usable on a single file.
@@ -23,7 +23,7 @@ CPython](https://github.com/python/cpython/blob/e0433c1e7/Doc/tools/rstlint.py).
2323

2424
## Using Sphinx Lint
2525

26-
To use Sphinx Lint, run:
26+
Here are some example invocations of Sphinx Lint from the command line:
2727

2828
```sh
2929
sphinx-lint # check all dirs and files
@@ -41,17 +41,8 @@ We recommend using a configuration like this:
4141
rev: LATEST_SPHINXLINT_RELEASE_TAG
4242
hooks:
4343
- id: sphinx-lint
44-
args: [--jobs=1]
45-
types: [rst]
4644
```
4745
48-
In particular, note that the `--jobs=1` flag is recommended for use with pre-commit.
49-
By default, Sphinx Lint uses `multiprocessing` to lint multiple files simultaneously,
50-
but this interacts poorly with pre-commit, which also attempts to use multiprocessing,
51-
leading to resource contention. Adding `--jobs=1` tells Sphinx Lint not to use
52-
multiprocessing itself, deferring to pre-commit on the best way to delegate resources
53-
across available cores.
54-
5546
5647
## Known issues
5748

0 commit comments

Comments
 (0)