Skip to content

Commit c4c8261

Browse files
authored
Enable link check during documentation build and fix broken (#2326)
1 parent d160556 commit c4c8261

File tree

12 files changed

+172
-168
lines changed

12 files changed

+172
-168
lines changed

docs/changelog.rst

Lines changed: 125 additions & 125 deletions
Large diffs are not rendered by default.
File renamed without changes.
File renamed without changes.

docs/changelog/806.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Enable link check during documentation build - by :user:`gaborbernat`.

docs/conf.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
import os
3+
import re
44
import sys
55
from datetime import date, datetime
66
from pathlib import Path
@@ -17,6 +17,7 @@
1717
from sphinx.domains.std import StandardDomain
1818
from sphinx.environment import BuildEnvironment
1919
from sphinx.ext.autodoc import Options
20+
from sphinx.ext.extlinks import ExternalLinksChecker
2021
from sphinx.locale import __
2122
from sphinx.util.docutils import SphinxDirective
2223
from sphinx.util.logging import getLogger
@@ -77,7 +78,10 @@
7778
extlinks = {
7879
"issue": ("https://github.com/tox-dev/tox/issues/%s", "#"),
7980
"pull": ("https://github.com/tox-dev/tox/pull/%s", "PR #"),
81+
"discussion": ("https://github.com/tox-dev/tox/discussions/%s", "#"),
8082
"user": ("https://github.com/%s", "@"),
83+
"gh_repo": ("https://github.com/%s", ""),
84+
"gh": ("https://github.com/%s", ""),
8185
"pypi": ("https://pypi.org/project/%s", ""),
8286
}
8387
intersphinx_mapping = {
@@ -86,8 +90,9 @@
8690
}
8791
nitpicky = True
8892
nitpick_ignore = []
89-
90-
os.environ["FORCE_COLOR"] = "yes" # force --colored default value to be yes
93+
linkcheck_workers = 10
94+
linkcheck_ignore = [re.escape(r"https://github.com/tox-dev/tox/issues/new?title=Trouble+with+development+environment")]
95+
extlinks_detect_hardcoded_links = True
9196

9297

9398
def skip_member(app: Sphinx, what: str, name: str, obj: Any, would_skip: bool, options: Options) -> bool: # noqa: U100
@@ -132,23 +137,15 @@ def resolve_xref(
132137
# fixup some wrongly resolved mappings
133138
mapping = {
134139
"_io.TextIOWrapper": "io.TextIOWrapper",
135-
"T": "typing.TypeVar",
136-
"V": "typing.TypeVar",
137-
"tox.config.of_type.T": "typing.TypeVar",
138-
"tox.config.loader.api.T": "typing.TypeVar",
139-
"tox.config.loader.convert.T": "typing.TypeVar",
140-
"tox.tox_env.installer.T": "typing.TypeVar",
141-
"ToxParserT": "typing.TypeVar",
142-
"_Section": "Section",
140+
"tox.config.of_type.T": "typing.TypeVar", # used by Sphinx bases
141+
"tox.config.loader.api.T": "typing.TypeVar", # used by Sphinx bases
142+
"tox.config.loader.convert.T": "typing.TypeVar", # used by Sphinx bases
143+
"tox.tox_env.installer.T": "typing.TypeVar", # used by Sphinx bases
143144
"concurrent.futures._base.Future": "concurrent.futures.Future",
144145
}
145146
if target in mapping:
146-
if target == "Factory":
147-
type = "attr"
148-
node["reftarget"] = mapping[target]
149-
if target == "_Section":
150-
target = "Section"
151-
contnode = Text(target, target)
147+
target = node["reftarget"] = mapping[target]
148+
# node.children[0].children[0] = Text(target, target)
152149
return super().resolve_xref(env, fromdocname, builder, type, target, node, contnode)
153150

154151
app.connect("autodoc-skip-member", skip_member)
@@ -240,3 +237,10 @@ def _register_ref(self, ref_name: str, ref_title: str, node: Element) -> None:
240237
self._std_domain.labels[of_name] = doc_name, ref_name, ref_title
241238

242239
app.add_directive(ToxConfig.name, ToxConfig)
240+
241+
def check_uri(self, refnode: reference) -> None:
242+
if refnode.document.attributes["source"].endswith("index.rst"):
243+
return # do not use for the index file
244+
return prev_check(self, refnode)
245+
246+
prev_check, ExternalLinksChecker.check_uri = ExternalLinksChecker.check_uri, check_uri

docs/development.rst

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@ Getting started
99
below will help you get started with development, testing, and documentation. We’re pleased that you are interested in
1010
working on tox. This document is meant to get you setup to work on tox and to act as a guide and reference
1111
to the development setup. If you face any issues during this process, please
12-
`open an issue <https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftox-dev%2Ftox%2Fissues%2Fnew%3Ftitle%3DTrouble%2Bwith%2Bdevelopment%2Benvironment>`_
13-
about it on the issue tracker.
12+
:issue:`new?title=Trouble+with+development+environment` about it on the issue tracker.
1413

1514
Setup
1615
~~~~~
1716

1817
tox is a command line application written in Python. To work on it, you'll need:
1918

20-
- **Source code**: available on `GitHub <https://github.com/tox-dev/tox>`_. You can use ``git`` to clone the
21-
repository:
19+
- **Source code**: available on :gh_repo:`GitHub <tox-dev/tox>`. You can use ``git`` to clone the repository:
2220

2321
.. code-block:: shell
2422
@@ -150,11 +148,10 @@ or whitespace within lines. Such changes can be made separately, as a "formattin
150148
Automated testing
151149
~~~~~~~~~~~~~~~~~
152150

153-
All pull requests and merges to the ``master`` branch are tested using
154-
`GitHub Actions <https://github.com/features/actions>`_ (configured by ``check.yml`` file inside the
155-
``.github/workflows`` directory). You can find the status and the results to the CI runs for your
156-
PR on GitHub's Web UI for the pull request. You can also find links to the CI services' pages for the specific builds in
157-
the form of "Details" links, in case the CI run fails and you wish to view the output.
151+
All pull requests and merges to the ``master`` branch are tested using :gh:`GitHub Actions <features/actions>`
152+
(configured by ``check.yml`` file inside the ``.github/workflows`` directory). You can find the status and the results
153+
to the CI runs for your PR on GitHub's Web UI for the pull request. You can also find links to the CI services' pages
154+
for the specific builds in the form of "Details" links, in case the CI run fails and you wish to view the output.
158155

159156
To trigger CI to run again for a pull request, you can close and open the pull request or submit another change to the
160157
pull request. If needed, project maintainers can manually trigger a restart of a job/build.
@@ -226,8 +223,8 @@ initiate a vote among the existing maintainers.
226223
Current maintainers
227224
^^^^^^^^^^^^^^^^^^^
228225

229-
- `Anthony Sottile <https://github.com/asottile>`_
230-
- `Bernát Gábor <https://github.com/gaborbernat>`_
231-
- `Jürgen Gmach <https://github.com/jugmac00>`_
232-
- `Miroslav Šedivý <https://github.com/eumiro>`_
233-
- `Oliver Bestwalter <https://github.com/obestwalter>`_
226+
- :user:`Anthony Sottile <asottile>`
227+
- :user:`Bernát Gábor <gaborbernat>`
228+
- :user:`Jürgen Gmach <jugmac00>`
229+
- :user:`Miroslav Šedivý <eumiro>`
230+
- :user:`Oliver Bestwalter <obestwalter>`

docs/installation.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ wheel
3232
Installing tox via a wheel (default with pip) requires an installer that can understand the ``python-requires`` tag (see
3333
`PEP-503 <https://www.python.org/dev/peps/pep-0503/>`_), with pip this is version ``9.0.0`` (released in November 2016).
3434
Furthermore, in case you're not installing it via PyPI you need to use a mirror that correctly forwards the
35-
``python-requires`` tag (notably the OpenStack mirrors don't do this, or older `devpi <https://github.com/devpi/devpi>`_
36-
versions - added with version ``4.7.0``).
35+
``python-requires`` tag (notably the OpenStack mirrors don't do this, or older :gh_repo:`devpi/devpi` versions -
36+
added with version ``4.7.0``).
3737

3838
.. _sdist:
3939

@@ -42,8 +42,8 @@ sdist
4242
When installing via a source distribution you need an installer that handles the
4343
`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`_ specification. In case of ``pip`` this is version ``18.0.0`` or
4444
later (released in July 2018). If you cannot upgrade your pip to support this you need to ensure that the build
45-
requirements from `pyproject.toml <https://github.com/tox-dev/tox/blob/master/pyproject.toml#L2>`_ are satisfied
46-
before triggering the installation.
45+
requirements from :gh:`pyproject.toml <tox-dev/tox/blob/rewrite/pyproject.toml#L2>` are satisfied before triggering the
46+
installation.
4747

4848
via ``setup.py``
4949
----------------
@@ -60,7 +60,7 @@ a pip version of at least ``18.0.0`` and use the following command:
6060

6161
.. code-block:: console
6262
63-
pip install git+https://github.com/tox-dev/tox.git@master
63+
pip install git+https://github.com/tox-dev/tox.git@rewrite
6464
6565
.. _compatibility-requirements:
6666

@@ -69,7 +69,7 @@ Python and OS Compatibility
6969

7070
tox works with the following Python interpreter implementations:
7171

72-
- `CPython <https://www.python.org/>`_ versions 3.6, 3.7, 3.8, 3.9, 3.10
72+
- `CPython <https://www.python.org/>`_ versions 3.7, 3.8, 3.9, 3.10
7373

7474
This means tox works on the latest patch version of each of these minor versions. Previous patch versions are supported
7575
on a best effort approach.

docs/plugins.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ What's in for you in this:
3232

3333
How to apply:
3434

35-
- create an issue under the ``tox-dev/tox`` Github repository with the title `Adopt plugin \<name\>
36-
<https://github.com/tox-dev/tox/issues/new?labels=feature%3Anew&template=feature_request.md&title=Adopt%20plugin&body=>`_,
35+
- create an issue under the ``tox-dev/tox`` Github repository with the title
36+
:gh:`Adopt plugin \<name\> <login?return_to=https%3A%2F%2Fgithub.com%2Ftox-dev%2Ftox%2Fissues%2Fnew%3Flabels%3Dfeature%253Anew%26template%3Dfeature_request.md%26title%3DAdopt%2520plugin%26body%3D>`,
3737
- wait for the green light by one of our maintainers (see :ref:`current-maintainers`),
3838
- follow the `guidance by Github
3939
<https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository>`_,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ name = "tox"
1818
filename = "docs/changelog.rst"
1919
directory = "docs/changelog"
2020
title_format = false
21-
issue_format = "`#{issue} <https://github.com/tox-dev/tox/issues/{issue}>`_"
21+
issue_format = ":issue:`{issue}`"
2222
template = "docs/changelog/template.jinja2"
2323
# possible types, all default: feature, bugfix, doc, removal, misc

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ console_scripts =
6161
[options.extras_require]
6262
docs =
6363
furo>=2021.8.17b43
64-
sphinx>=4.1
64+
sphinx>=4.4
6565
sphinx-argparse-cli>=1.7
66-
sphinx-autodoc-typehints>=1.15
66+
sphinx-autodoc-typehints>=1.16
6767
sphinx-copybutton>=0.4
6868
sphinx-inline-tabs>=2021.4.11b9
6969
sphinxcontrib-towncrier>=0.2.0a0

0 commit comments

Comments
 (0)