Skip to content

Commit 863e114

Browse files
[doc] Add an assertion for redirection that will silentely fail
1 parent 7e0a6d6 commit 863e114

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

doc/conf.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,28 @@
4747

4848

4949
# Single file redirects are handled in this file and can be done by a pylint
50-
# contributor. See:
50+
# contributor if no englobing full directory redirect is applied first. See:
5151
# https://documatt.gitlab.io/sphinx-reredirects/usage.html
5252
# Directory redirects are handled in ReadTheDoc admin interface and can only be done
5353
# by pylint maintainers at the following URL:
5454
# https://readthedocs.org/dashboard/pylint/redirects/
55+
DIRECTORY_REDIRECT = [
56+
# This list has no effect it must be manually updated from the Read the doc conf
57+
"messages/",
58+
]
5559
redirects: dict[str, str] = {
5660
# "<source>": "<target>"
5761
"intro": "index.html",
5862
"support": "contact.html",
5963
"user_guide/ide-integration": "installation.html",
60-
"messages/messages_introduction": "user_guide/messages/index.html",
61-
"messages/messages_list": "user_guide/messages/messages_overview.html",
6264
"user_guide/message-control": "user_guide/messages/message_control.html",
6365
}
66+
for m in redirects:
67+
for r in DIRECTORY_REDIRECT:
68+
assert not m.startswith(r), (
69+
f"Redirection will silentely fail: '{m}' start with '{r}' and "
70+
"the whole directory is redirected by ReadtheDoc conf already."
71+
)
6472

6573
# Add any paths that contain templates here, relative to this directory.
6674
templates_path = ["_templates"]

0 commit comments

Comments
 (0)