Skip to content

Commit 3bc570f

Browse files
committed
dev: include Markdown link checks in the local lint suite
`dev/rust_lint.sh` now runs `ci/scripts/markdown_link_check.sh` as a read-only step, after the workflow install check and before the Rust documentation build. The runner loads `LYCHEE_VERSION` from `ci/scripts/utils/tool_versions.sh` and installs that pinned version when `lychee` is missing. An already installed `lychee` is used as is, matching the runner's existing policy for other tools. The checker becomes executable so the runner can invoke it directly, as it does for every other registered script. Its body, configuration, file selection, and the GitHub workflow are unchanged, and `--write` never reaches the link check. Partial progress on #21048.
1 parent c2cf289 commit 3bc570f

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎ci/scripts/markdown_link_check.sh‎

100644100755
File mode changed.

‎dev/rust_lint.sh‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#
2323
# Note: The installed checking tools (e.g., taplo) are not guaranteed to match
2424
# the CI versions for simplicity, there might be some minor differences. Check
25-
# `.github/workflows` for the CI versions.
25+
# `.github/workflows` for the CI versions. When this script installs a missing
26+
# tool that has a pinned version in `ci/scripts/utils/tool_versions.sh`, it
27+
# installs that pinned version. An already installed tool is used as is.
2628
#
2729
#
2830
#
@@ -84,10 +86,15 @@ while [[ $# -gt 0 ]]; do
8486
done
8587

8688
SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
89+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
90+
91+
# Load the tool versions shared with CI (for example, LYCHEE_VERSION).
92+
source "${SCRIPT_DIR}/../ci/scripts/utils/tool_versions.sh"
8793

8894
ensure_tool "taplo" "cargo install taplo-cli --locked"
8995
ensure_tool "hawkeye" "cargo install hawkeye --locked"
9096
ensure_tool "typos" "cargo install typos-cli --locked"
97+
ensure_tool "lychee" "cargo install lychee --locked --version ${LYCHEE_VERSION}"
9198

9299
run_step() {
93100
local name="$1"
@@ -107,6 +114,7 @@ declare -a WRITE_STEPS=(
107114

108115
declare -a READONLY_STEPS=(
109116
"ci/scripts/check_no_cargo_install_in_workflows.sh|false"
117+
"ci/scripts/markdown_link_check.sh|false"
110118
"ci/scripts/rust_docs.sh|false"
111119
)
112120

‎docs/source/contributor-guide/testing.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,14 @@ tested in the same way using the [doc_comment] crate. See the end of
188188

189189
## Documentation Link Checks
190190

191-
Run the internal markdown link check locally:
191+
The local lint suite, `./dev/rust_lint.sh`, includes the internal markdown link
192+
check. When `lychee` is not on your `PATH`, the suite installs the version
193+
pinned in `ci/scripts/utils/tool_versions.sh`, which is the version CI uses. An
194+
already installed `lychee` is used as is, so its version can differ from the
195+
CI pin. The check is read-only: `--write` and `--allow-dirty` do not change
196+
links.
197+
198+
Run the internal markdown link check on its own:
192199

193200
```shell
194201
source ci/scripts/utils/tool_versions.sh

0 commit comments

Comments
 (0)