Skip to content

Use sphinx-lint in make check. #866

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

Merged
merged 4 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ VENVDIR = ./venv
BUILDDIR = _build
SPHINXOPTS =
SPHINXBUILD = $(VENVDIR)/bin/sphinx-build
SPHINXLINT = $(VENVDIR)/bin/sphinx-lint
PAPER =

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

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

serve:
@echo "The 'serve' target was removed, use 'htmlview' instead" \
Expand Down
2 changes: 1 addition & 1 deletion gh-faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ particularly useful outside of the change log.

.. _bpo: https://bugs.python.org/
.. _GitHub search syntax: https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax
.. _advanced search: https://github.com/search/advanced
.. _advanced search: https://github.com/search/advanced
14 changes: 13 additions & 1 deletion make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ if "%PYTHON%" == "" (
set PYTHON=py -3
)

if not defined SPHINXLINT (
%PYTHON% -c "import sphinxlint" > nul 2> nul
if errorlevel 1 (
echo Installing sphinx-lint with %PYTHON%
rem Should have been installed with Sphinx earlier
%PYTHON% -m pip install "sphinx-lint<1"
if errorlevel 1 exit /B
)
set SPHINXLINT=%PYTHON% -m sphinxlint
)

set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
if NOT "%PAPER%" == "" (
Expand Down Expand Up @@ -202,7 +213,8 @@ results in %BUILDDIR%/doctest/output.txt.
)

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

:serve
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Sphinx==4.5.0
furo<2022.4.8
sphinx_copybutton>=0.3.3
sphinx-lint<1
2 changes: 1 addition & 1 deletion setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,4 @@ every rule.
Various tools that are (or have been) used to maintain Python.


.. _issue tracker: https://github.com/python/cpython/issues
.. _issue tracker: https://github.com/python/cpython/issues
2 changes: 1 addition & 1 deletion silencewarnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ If you decide to tackle a warning you have found, open an issue on the `issue
tracker`_ (if one has not already been opened) and say you are going to try and
tackle the issue, and then proceed to fix the issue.

.. _issue tracker: https://github.com/python/cpython/issues
.. _issue tracker: https://github.com/python/cpython/issues