Commit Graph

264 Commits

Author SHA1 Message Date
Adam Turner
b458850b32 Bump Ruff to 0.8.1 2024-11-29 23:09:10 +00:00
Adam Turner
7801bd77b8 Make `os.path` imports absolute 2024-11-03 17:41:43 +00:00
James Addison
63a4175b53
linkcheck: Remove unused 'local' status code (#13068) 2024-10-25 18:58:05 +01:00
Adam Turner
41c405c1a5 Use f-strings in `CheckExternalLinksBuilder.process_result()` 2024-10-21 00:15:32 +01:00
James Addison
d3dd8e43cb
Use structural pattern matching to handle linkcheck result statuses (#13049)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-10-21 00:11:20 +01:00
James Addison
88f560c761
Use a `StrEnum` to record linkcheck status codes (#13043)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-10-20 18:56:22 +01:00
Adam Turner
e41617850f Define `_StatusUnknown and _URIProperties{Unknown}` 2024-10-19 20:57:58 +01:00
Adam Turner
d773a43f59
Codify linkcheck status codes into a `Literal` (#13040) 2024-10-19 20:44:21 +01:00
Adam Turner
e58dd58f35 Enable the PLR6201 lint in Ruff 2024-10-19 19:05:43 +01:00
Adam Turner
40f8693661 Add `sphinx.util._uri` 2024-10-05 16:47:26 +01:00
Adam Turner
5d76f840bb Format `sphinx/builders/` 2024-10-05 01:37:14 +01:00
Adam Turner
fadb6b10cb
Stop exiting early with `--fail-on-warnings; add --exception-on-warning` (#12743)
Co-authored-by: Jeremy Maitin-Shepard <jbms@google.com>
2024-08-13 17:12:42 +01:00
Adam Turner
b511537597
`_StrPath is dead; long live _StrPath` (#12690) 2024-07-26 17:33:55 +01:00
Adam Turner
de15d61a46 Use pathlib in `sphinx.project` 2024-07-23 04:52:32 +01:00
Adam Turner
9e3f4521db
Drop support for Python 3.9 (#12633) 2024-07-22 15:05:15 +01:00
James Addison
cc08854bc2
linkcheck: Update configuration defaults for Sphinx 8.0 (#12630)
- Links that respond with HTTP 401 (unauthorized) responses are now considered ``broken`` by default.
- Timeouts that occur when checking a link are now reported with a distinct `timeout` status code, instead of the previous ``broken``.
- The previous behaviours are still available and can be configured on an opt-in basis per-project using ``conf.py``.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-07-20 20:41:22 +01:00
Adam Turner
00544bb997
Remove `sphinx.builders` from the no-any-generics whitelist (#12574) 2024-07-15 02:27:03 +00:00
James Addison
35e7bfc347
linkcheck: Ignore URLs that respond with non-Unicode content (#12197) 2024-07-14 03:48:38 +01:00
James Addison
7011459fe9
linkcheck: Use old-style string formatting to fix gettext (#12560) 2024-07-13 17:45:16 +01:00
James Addison
6b237d9a70
[linkcheck] Allow integer for linkcheck_rate_limit_timeout (#12470)
Eliminate type-related warnings when users configure a valid integer value for the `linkcheck_rate_limit_timeout` config setting.

Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
2024-06-24 17:26:24 +00:00
James Addison
9467bf7849
[typehints] tests: enable mypy for linkcheck builder tests. (#12160) 2024-05-15 04:13:57 +02:00
James Knight
04b229fe4d
linkcheck: add `HyperlinkCollector.find_url()` (#12213)
Signed-off-by: James Knight <james.d.knight@live.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-04-24 19:19:44 +01:00
James Addison
2008aa8c78
linkcheck: Store the original (unquoted) anchor (#12206) 2024-04-24 18:07:31 +00:00
James Addison
532ad0306e
linkcheck: Make the new 'timeout' status opt-in (#12023)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-04-12 23:18:22 +01:00
Adam Turner
3421e5382a
Narrow `Generator[T, None, None] types to Iterator[T]` (#12241) 2024-04-09 03:26:44 +01:00
Bénédikt Tran
cb8a28dd7e
[mypy] add stubs for color functions (#12217) 2024-04-01 13:45:47 +02:00
Chris Sewell
d59b158371
👌 Make ExtensionMetadata type public and use it in internal extensions (#12153)
This type alias has now been fully documented for public consumption.

This will be beneficial to the sphinx ecosystem,
to aide/encourage extension developers to provide the correct metadata.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-03-21 16:19:26 +01:00
danieleades
f9c8943889
Use `# NoQA` consistently (#11903)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-01-21 20:20:58 +00:00
danieleades
f7fbfaa471
Enable various pydocstyle (D) rules (#11878)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-01-14 21:13:46 +00:00
James Addison
2b47fd4b4b
Update linkcheck_timeout value and documentation (#11875) 2024-01-13 17:41:28 +00:00
James Addison
9e198c70fd
linkcheck: add a distinct 'timeout' reporting status (#11876) 2024-01-13 08:14:06 +00:00
James Addison
6083351320
linkcheck: Expand another GitHub shorthand issue reference (#11864) 2024-01-09 13:14:05 +00:00
James Addison
5211c01646
Enable reporting HTTP 401 hyperlinks as broken in linkcheck (#11684)
Co-authored-by: picnixz <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-01-09 12:33:40 +00:00
Adam Turner
19b2950511 Narrow the type for configuration option 'rebuild' values 2024-01-03 04:17:46 +00:00
Dmitry Shachnev
2f025a4b22
linkcheck: Fix conversion from UTC time to the UNIX epoch (#11649)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-08-28 03:39:13 +00:00
Adam Turner
6cb783c002 Enable SIM105 (use contextlib.suppress) 2023-08-14 00:18:14 +01:00
Adam Turner
ae0d97bb26 Use `parsedate_tz` in the linkcheck builder 2023-08-13 22:11:15 +01:00
Adam Turner
d4169a32e7 Use `parsedate_tz` in the linkcheck builder 2023-08-13 22:11:15 +01:00
Adam Turner
92e60b3f15 Fix PGH003 (type: ignore comment must have parameters) 2023-08-13 22:11:15 +01:00
Adam Turner
43ab23a61f Merge branch '7.1.x'
# Conflicts:
#	CHANGES
#	sphinx/__init__.py
2023-08-02 02:58:30 +01:00
James Addison
06c1339bb3
Ensure that `linkcheck_anchors` is properly respected (#11544)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-08-02 02:55:37 +01:00
Jean-François B
4958d2abf1 Fix flake8 E231 reported linting failure 2023-08-02 02:04:55 +01:00
Jean-François B
eb0499a696 Fix flake8 E231 reported linting failure 2023-07-30 15:00:55 +02:00
Adam Turner
ad61e41157
Drop support for Python 3.8 (#11511) 2023-07-25 02:07:23 +01:00
picnixz
82bc15aec3
Enable skipping anchor verification on a per-URL basis (#11489)
Add a new ``linkcheck_anchors_ignore_for_url`` configuration variable.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-24 12:15:42 +01:00
James Addison
450ad637ac
Begin using session-based HTTP requests in the linkcheck builder (#11503)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-23 22:23:08 +01:00
danieleades
4de540efb6
Enable mypy 'strict optional' for 19 modules (#11422)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-07-23 21:29:04 +01:00
James Addison
71db08c051
Style refactoring in the `linkcheck` builder (#11501)
- Omit a variable that is unused aside from a ``return`` statement on the subsequent line.
- Extract a variable for readability, and to reduce the complexity of a line.
2023-07-23 14:31:09 +01:00
Adam Turner
d71c781187
Re-structure the `linkcheck` builder (#11499)
Re-organise and re-structure the ``linkcheck`` builder:

- All functions defined within functions are factored out into top-level functions or class methods
- Classes and methods have been re-arranged (Builder, PostTransform, Checker, Worker)
- TLS verification on ``sphinx.util.requests`` has been changed to not pass the ``Config`` object all the way down
- The ``Hyperlink`` object now stores the document path
- ``BuildEnvironment`` and ``Config`` objects are used to extract properties and are not stored as class attributes
2023-07-23 00:01:41 +01:00
James Addison
13720de50c
Treat SSL failures as broken links in the linkcheck builder (#11431)
TLS operates at a lower layer than HTTP, and so if there is a TLS-related error from a host,
it seems unlikely that retrying with a different higher-layer protocol request
(HTTP GET instead of HTTP HEAD) could succeed.
We should not make additional HTTP requests that we do not believe will succeed.
2023-07-20 21:38:21 +01:00