Skip to content

Apache DataFusion SQL Query Engine

dev: include Markdown link checks in the local lint suite (#25287)

Kumar Ujjawalafaee3d4cece
diff --git a/ci/scripts/markdown_link_check.sh b/ci/scripts/markdown_link_check.sh
old mode 100644
new mode 100755
diff --git a/dev/rust_lint.sh b/dev/rust_lint.sh
index 73cab9c7f7..542ed18c6b 100755
--- a/dev/rust_lint.sh
+++ b/dev/rust_lint.sh
@@ -22,7 +22,9 @@
#
# Note: The installed checking tools (e.g., taplo) are not guaranteed to match
# the CI versions for simplicity, there might be some minor differences. Check
-# `.github/workflows` for the CI versions.
+# `.github/workflows` for the CI versions. When this script installs a missing
+# tool that has a pinned version in `ci/scripts/utils/tool_versions.sh`, it
+# installs that pinned version. An already installed tool is used as is.
#
#
#
@@ -84,10 +86,15 @@ while [[ $# -gt 0 ]]; do
done
SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
+# Load the tool versions shared with CI (for example, LYCHEE_VERSION).
+source "${SCRIPT_DIR}/../ci/scripts/utils/tool_versions.sh"
ensure_tool "taplo" "cargo install taplo-cli --locked"
ensure_tool "hawkeye" "cargo install hawkeye --locked"
ensure_tool "typos" "cargo install typos-cli --locked"
+ensure_tool "lychee" "cargo install lychee --locked --version ${LYCHEE_VERSION}"
run_step() {
local name="$1"
@@ -107,6 +114,7 @@ declare -a WRITE_STEPS=(
declare -a READONLY_STEPS=(
"ci/scripts/check_no_cargo_install_in_workflows.sh|false"
+ "ci/scripts/markdown_link_check.sh|false"
"ci/scripts/rust_docs.sh|false"
)
diff --git a/docs/source/contributor-guide/testing.md b/docs/source/contributor-guide/testing.md
index 44bd327013..2d0cad99cf 100644
--- a/docs/source/contributor-guide/testing.md
+++ b/docs/source/contributor-guide/testing.md
@@ -188,7 +188,12 @@ tested in the same way using the [doc_comment] crate. See the end of
## Documentation Link Checks
-Run the internal markdown link check locally:
+`./dev/rust_lint.sh` runs the internal markdown link check. If `lychee` is
+missing, the script installs the version pinned in
+`ci/scripts/utils/tool_versions.sh`. It uses an existing installation as is,
+even if the version differs from the pin.
+
+To run the check on its own:
```shell
source ci/scripts/utils/tool_versions.sh
@@ -200,6 +205,7 @@ Notes:
- The script is run with `bash` and is compatible with the default Bash on macOS (no `mapfile` dependency).
- The CI configuration currently checks internal markdown links only. External `http(s)` and `mailto` links are excluded to avoid flaky failures.
+- The check only reports broken links. `./dev/rust_lint.sh --write` does not change them.
When a link is broken, lychee prints the file and URL/path that failed. For example: