Use pre-commit hook to run doc8

Also create a separate doc requirements to install only required
packages during doc build or doc build check.

Change-Id: Ic0377868fdc3057314ae1dec0a0db0b1cc0c0b7b
This commit is contained in:
Takashi Kajinami 2024-10-21 19:35:42 +09:00
parent 116055a912
commit 60922c8a28
4 changed files with 16 additions and 7 deletions

View File

@ -23,6 +23,11 @@ repos:
hooks:
- id: hacking
additional_dependencies: []
- repo: https://github.com/PyCQA/doc8
rev: v1.1.2
hooks:
- id: doc8
files: doc/source/.*\.rst$
- repo: https://github.com/asottile/pyupgrade
rev: v3.18.0
hooks:

4
doc/requirements.txt Normal file
View File

@ -0,0 +1,4 @@
sphinx>=2.0.0 # BSD
openstackdocstheme>=2.2.1 # Apache-2.0
reno>=3.1.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD

View File

@ -1,11 +1,5 @@
coverage>=4.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD
sphinx>=2.0.0 # BSD
openstackdocstheme>=2.2.1 # Apache-2.0
stestr>=2.0.0 # Apache-2.0
testtools>=2.2.0 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
doc8>=0.8.1 # Apache-2.0
reno>=3.1.0 # Apache-2.0
pre-commit>=2.6.0 # MIT

View File

@ -18,10 +18,12 @@ commands =
commands = oslo_debug_helper {posargs}
[testenv:pep8]
deps =
pre-commit>=2.6.0 # MIT
{[testenv:docs]deps}
commands =
pre-commit run -a
sphinx-build -b doctest doc/source doc/build
doc8 --ignore-path "doc/source/history.rst" doc/source
[testenv:venv]
commands = {posargs}
@ -36,6 +38,9 @@ commands =
coverage xml -o cover/coverage.xml
[testenv:docs]
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W --keep-going -b html -d doc/build/doctrees doc/source doc/build/html
[flake8]
@ -45,5 +50,6 @@ ignore = E123,E125
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[testenv:releasenotes]
deps = {[testenv:docs]deps}
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html