test: Add a links checker and fix some links

This commit is contained in:
xlai89
2024-05-12 16:59:13 +02:00
committed by James Shubin
parent 09e53bfd3f
commit 201cf091d5
8 changed files with 32 additions and 7 deletions

View File

@@ -42,6 +42,13 @@ EOF
#STYLE="test/mdl.style" # style file
LYCHEE=$(command -v lychee 2>/dev/null) || true
if [ -z "$LYCHEE" ]; then
fail_test "The 'lychee' utility can't be found.
Installation guide:
https://github.com/lycheeverse/lychee/blob/master/README.md#installation"
fi
find_files() {
git ls-files | grep '\.md$'
}
@@ -64,6 +71,12 @@ bad_files=$(
if ! "$MDL" --style "$STYLE" "$i" 1>&2; then
echo "$i"
fi
# check links in docs
# if file is from the directory docs/ then check links
if [[ "$i" == docs/* ]] && ! "$LYCHEE" -n "$i" 1>&2; then
echo "$i"
fi
done
)