Skip to content

Commit 7b86c20

Browse files
ezio-melottihugovkzooba
authored
Use sphinx-lint in make check. (#866)
* Use sphinx-lint in `make check`. * Fix missing newlines at the end of files. * Add `venv` as a dependency for the `check` target. Co-authored-by: Hugo van Kemenade <[email protected]> * Specify `sphinx-lint` version in `make.bat`. Co-authored-by: Steve Dower <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Steve Dower <[email protected]>
1 parent 7dad04b commit 7b86c20

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ VENVDIR = ./venv
77
BUILDDIR = _build
88
SPHINXOPTS =
99
SPHINXBUILD = $(VENVDIR)/bin/sphinx-build
10+
SPHINXLINT = $(VENVDIR)/bin/sphinx-lint
1011
PAPER =
1112

1213
# Internal variables.
@@ -153,8 +154,9 @@ doctest: venv
153154
htmlview: html
154155
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('_build/html/index.html'))"
155156

156-
check:
157-
$(PYTHON) tools/rstlint.py -i tools -i venv
157+
check: venv
158+
# Ignore the tools and venv dirs and check that the default role is not used.
159+
$(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role
158160

159161
serve:
160162
@echo "The 'serve' target was removed, use 'htmlview' instead" \

gh-faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ particularly useful outside of the change log.
117117

118118
.. _bpo: https://bugs.python.org/
119119
.. _GitHub search syntax: https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax
120-
.. _advanced search: https://github.com/search/advanced
120+
.. _advanced search: https://github.com/search/advanced

make.bat

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ if "%PYTHON%" == "" (
1010
set PYTHON=py -3
1111
)
1212

13+
if not defined SPHINXLINT (
14+
%PYTHON% -c "import sphinxlint" > nul 2> nul
15+
if errorlevel 1 (
16+
echo Installing sphinx-lint with %PYTHON%
17+
rem Should have been installed with Sphinx earlier
18+
%PYTHON% -m pip install "sphinx-lint<1"
19+
if errorlevel 1 exit /B
20+
)
21+
set SPHINXLINT=%PYTHON% -m sphinxlint
22+
)
23+
1324
set BUILDDIR=_build
1425
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
1526
if NOT "%PAPER%" == "" (
@@ -202,7 +213,8 @@ results in %BUILDDIR%/doctest/output.txt.
202213
)
203214

204215
:check
205-
cmd /C %PYTHON% tools\rstlint.py -i tools -i venv
216+
rem Ignore the tools and venv dirs and check that the default role is not used.
217+
cmd /S /C "%SPHINXLINT% -i tools -i venv --enable default-role"
206218
goto end
207219

208220
:serve

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Sphinx==4.5.0
22
furo<2022.4.8
33
sphinx_copybutton>=0.3.3
4+
sphinx-lint<1

setup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,4 +556,4 @@ every rule.
556556
Various tools that are (or have been) used to maintain Python.
557557

558558

559-
.. _issue tracker: https://github.com/python/cpython/issues
559+
.. _issue tracker: https://github.com/python/cpython/issues

silencewarnings.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ If you decide to tackle a warning you have found, open an issue on the `issue
1515
tracker`_ (if one has not already been opened) and say you are going to try and
1616
tackle the issue, and then proceed to fix the issue.
1717

18-
.. _issue tracker: https://github.com/python/cpython/issues
18+
.. _issue tracker: https://github.com/python/cpython/issues

0 commit comments

Comments
 (0)