Skip to content

Commit f8ab903

Browse files
committed
Add sphinx-lint and run it in CI
1 parent 619589d commit f8ab903

File tree

4 files changed

+154
-11
lines changed

4 files changed

+154
-11
lines changed

.github/sphinx-problem-matcher.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
{
22
"problemMatcher": [
33
{
4-
"owner": "sphinx",
4+
"owner": "sphinx-build",
55
"pattern": [
66
{
7-
"regexp": "^([^:]+):(\\d+): (WARNING: )?(.+)$",
7+
"regexp": "^([^:]+):\\s(.+)$",
8+
"file": 1,
9+
"message": 2
10+
},
11+
{
12+
"regexp": "^([^:]+):(\\d+):\\s(.+)$",
13+
"file": 1,
14+
"line": 2,
15+
"message": 3
16+
}
17+
]
18+
},
19+
{
20+
"owner": "sphinx-lint",
21+
"pattern": [
22+
{
23+
"regexp": "^([^:]+):(\\d+):\\s+(.*)\\s\\(([a-z-]+)\\)$",
824
"file": 1,
925
"line": 2,
10-
"message": 4
26+
"message": 3,
27+
"code": 4
1128
}
1229
]
1330
}

.github/workflows/lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
run: echo "::add-matcher::.github/sphinx-problem-matcher.json"
131131

132132
- name: Build docs
133-
run: |-
134-
poe docs |& tee /tmp/output
135-
# fail the job if there are issues
136-
grep -q " WARNING:" /tmp/output && exit 1 || exit 0
133+
run: poe docs -e SPHINXOPTS=--fail-on-warning
134+
135+
- name: Lint docs
136+
run: poetry run sphinx-lint --enable all $(git ls-files docs)

poetry.lock

Lines changed: 127 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ soco = { version = "*", optional = true }
7979

8080
pydata-sphinx-theme = { version = "*", optional = true }
8181
sphinx = { version = "*", optional = true }
82+
sphinx-lint = { version = ">=1.0.0", optional = true }
8283

8384
[tool.poetry.group.test.dependencies]
8485
beautifulsoup4 = "*"
@@ -127,7 +128,7 @@ beatport = ["requests-oauthlib"]
127128
bpd = ["PyGObject"] # gobject-introspection, gstreamer1.0-plugins-base, python3-gst-1.0
128129
chroma = ["pyacoustid"] # chromaprint or fpcalc
129130
# convert # ffmpeg
130-
docs = ["pydata-sphinx-theme", "sphinx"]
131+
docs = ["pydata-sphinx-theme", "sphinx", "sphinx-lint"]
131132
discogs = ["python3-discogs-client"]
132133
embedart = ["Pillow"] # ImageMagick
133134
embyupdate = ["requests"]
@@ -265,7 +266,7 @@ select = [
265266
"W", # pycodestyle
266267
]
267268
ignore = [
268-
"TC006" # no need to quote 'cast's since we use 'from __future__ import annotations'
269+
"TC006", # no need to quote 'cast's since we use 'from __future__ import annotations'
269270
]
270271

271272
[tool.ruff.lint.per-file-ignores]

0 commit comments

Comments
 (0)