forked from project-oak/oak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_docs
executable file
·22 lines (18 loc) · 756 Bytes
/
check_docs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
#
# Check that Rust documentation is generated without any warnings.
readonly SCRIPTS_DIR="$(dirname "$0")"
# shellcheck source=scripts/common
source "$SCRIPTS_DIR/common"
DOCS_OUT="$(cargo doc --document-private-items --no-deps 2>&1)"
# `cargo doc` produces warnings for incorrect paths. These warnings cannot be promoted to errors, so we use grep to detect them.
if grep --ignore-case --quiet --regexp='^warning' <<< "$DOCS_OUT"; then
echo "Warnings found when generating the docs."
exit 1
fi
# Check for any deadlinks in the generated docs.
if ! cargo deadlinks --dir target/doc; then
echo "Found deadlinks in the generated docs."
# TODO(#2007): Return error once invalid documentation from `tracing` crate is fixed.
exit 0
fi