Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New linter error if the link in more information isn’t reachable anymore #280

Open
sebastiaanspeck opened this issue Oct 19, 2023 · 6 comments

Comments

@sebastiaanspeck
Copy link
Member

To keep the pages up-to-date, we could introduce an linter error if the link in “More information” isn’t working/reachable.

@kbdharun
Copy link
Member

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?

@sebastiaanspeck
Copy link
Member Author

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

@owenvoke
Copy link
Member

owenvoke commented Oct 20, 2023

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. 😬

@sebastiaanspeck
Copy link
Member Author

I get that! Maybe we can create a script that run's once a month to report any broken links?

@kbdharun
Copy link
Member

kbdharun commented Oct 20, 2023

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.

@gutjuri
Copy link
Member

gutjuri commented Mar 18, 2024

This issue may be closed by tldr-pages/tldr#12506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants