Something went wrong. Try again.
Identities for entities did.bot
agent llm did
Something went wrong. Try again.
Shell
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849#!/usr/bin/env bash# Two things the rustdoc build cannot see, checked here instead.## 1. A ```rust fence in docs/ that is not compiled. Fences reach rustdoc# through include_str! and are compiled as doctests, but only if they are# tagged `rust` or left untagged. A fence tagged `text`, `ignore` or# `no_run` is prose wearing a code costume, and prose that claims to be# Rust rots silently.# 2. A relative link between docs/ pages whose target file does not exist.# rustdoc resolves intra-doc links to Rust items, not to sibling markdown# files, so these are invisible to it.set -euo pipefail
cd "$(dirname "$0")/.."
status=0
if [ -d docs ]; then while IFS= read -r -d '' page; do # 1. untested fences while IFS=: read -r lineno fence; do case "$fence" in '```ignore'*|'```no_run'*|'```rust,ignore'*|'```rust,no_run'*) echo "$page:$lineno: rust fence is not compiled: $fence" >&2 status=1 ;; esac done < <(grep -n '^```' "$page" || true)
# 2. relative links to missing files while IFS= read -r target; do [ -z "$target" ] && continue case "$target" in http*|'#'*|mailto:*) continue ;; esac resolved="$(dirname "$page")/${target%%#*}" if [ ! -e "$resolved" ]; then echo "$page: link target does not exist: $target" >&2 status=1 fi done < <(grep -oE '\]\([^)]+\)' "$page" | sed -E 's/^\]\(//; s/\)$//' || true) done < <(find docs -name '*.md' -print0)fi
if [ "$status" -eq 0 ]; then echo "doc-lint: ok"fiexit "$status"