Open sebastiaanspeck opened 8 months ago
Can you explain a bit about how we could implement it in Linter?
Would you ping the page's links to check if it is reachable? Or is there something we can use natively?
We could use wget to do something like this:
LINK_OF_INTEREST=$(awk 'NR==3{print $3}' file.md)
TOTAL_TIME=$(wget --page-requisites --output-document /dev/null "$LINK_OF_INTEREST" 2>&1 | grep -oE 'Total wall clock time: [0-9.]+s' | grep -oE '[0-9.]+')
if [ "$(echo "$TOTAL_TIME < 1" | bc -l)" -eq 1 ]; then
echo "Total time is below 1 second"
else
echo "Total time is 1 second or more"
fi
I think that this shouldn't really be part of the linter. 🤔 Especially as the linter runs every time a new page is added (or a PR is merged), we might be spamming a lot of sites. 😬
I get that! Maybe we can create a script that run's once a month to report any broken links?
I think that this shouldn't really be part of the linter. 🤔 Especially as the linter runs every time a new page is added (or a PR is merged), we might be spamming a lot of sites. 😬
This is exactly what I thought too as we document lesser-known tools too, we might be stressing their servers by sending multiple requests at a time if it got included in the linter.
This issue may be closed by https://github.com/tldr-pages/tldr/pull/12506
To keep the pages up-to-date, we could introduce an linter error if the link in “More information” isn’t working/reachable.