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

feat: markdownlint: Add a links checker and fix some links #758

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xlai89
Copy link

@xlai89 xlai89 commented May 5, 2024

Add a links checker using lychee into test-markdownlint.sh

Some links are fixed as well.

Fixes #440.

Main reason to choose lychee over muffet:
easy to use. lychee can deal with files, path wildcards and urls, while muffet expects urls as input.

@xlai89
Copy link
Author

xlai89 commented May 5, 2024

Hi @purpleidea ,
should the following deprecated links just be removed? Didn't manage to update them.

[docs/on-the-web.md]:
✗ [404] https://www.youtube.com/watch?v=jB992Zb3nH0&html5=1 | Failed: Network error: Not Found
✗ [404] https://www.youtube.com/watch?v=MmpwOQAb_SE&html5=1 | Failed: Network error: Not Found
✗ [404] https://vimeo.com/191493409 | Failed: Network error: Not Found
✗ [ERR] https://roidelapluie.be/blog/2017/02/14/mgmt-augeas/ | Failed: Network error: error sending request for url (https://roidelapluie.be/blog/2017/02/14/mgmt-augeas/)
✗ [ERR] https://annex.debconf.org//debconf-share/debconf16/slides/15-next-generation-config-mgmt.pdf | Failed: Network error: error sending request for url (https://annex.debconf.org//debconf-share/debconf16/slides/15-next-generation-config-mgmt.pdf)

Copy link
Owner

@purpleidea purpleidea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! One question, and also what do you think we need to do about the timeouts and other issues in the logs? I'll look at the broken links not included in your patch.

Also your commit message should be:

test: Add a links checker and fix some links

To pass...

STYLE=$($mktemp)
# create a tmp file in current directory e.g. "./tmp.rMKAQ63Cm6"
# so that mdl command can locate the file (must contain a '/' or end in '.rb')
STYLE=$($mktemp -p .)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After updating mdl to 0.13.0 locally, the test passes as well in my dev env. This change is not necessary and has been removed from the patch.

@purpleidea
Copy link
Owner

I am just uploading some fixed links, and I will submit a patch to git master with the fixes. After that is done, in theory rebasing your patch should be enough. Thanks again!

@purpleidea
Copy link
Owner

Should be ready for rebase.

@xlai89
Copy link
Author

xlai89 commented May 5, 2024

Thanks for the hint!
Rebase is done. Also corrected the commit message and removed the unnecessary changes.
Can you be more specific about "the timeouts and other issues in the logs" mentioned in an earlier comment?

@purpleidea
Copy link
Owner

Rebase is done.

Awesome running tests now.

Also corrected the commit message and removed the unnecessary changes.

Sweet.

Can you be more specific about "the timeouts and other issues in the logs" mentioned in an earlier comment?

Yes, sorry about my lack of clarity. In the previous build test: https://github.com/purpleidea/mgmt/actions/runs/8958628695/job/24604796138#step:6:178

I see some network timeout issues. Is that a concern? Let's see what this run does. Here's a screenshot:

image

It occured to me that GH actions might actually rate limit things. If so we might have to disable some stuff. We'll see.

@purpleidea
Copy link
Owner

It seems it might be following a non-link but pretending it's a link. Is there a way to disable that?
(And the formatting needs fixing to wrap at 80.)

@xlai89
Copy link
Author

xlai89 commented May 12, 2024

Sorry for the late reply.

It seems it might be following a non-link but pretending it's a link. Is there a way to disable that?

Links can be excluded by add them into .lycheeignore, which contains 2 links for the moment.

(And the formatting needs fixing to wrap at 80.)

If you mean output of the lychee command, I could change the format with the option --format but couldn't limit the length of errors. When it comes to the length of my codes, I somehow didn't find the spot exceeding 80.

Copy link
Owner

@purpleidea purpleidea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch looks good. One quick Q. But otherwise should we merge?

@@ -0,0 +1,3 @@
# list URLs that should be excluded for lychee link checher
https://roidelapluie.be
https://github.com/purpleidea/mgmt/commit
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want to exclude this URL?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring the first url because it does not work, like in a previous build test.
Ignoring the second url because of possible rate limiting e.g. in this build test.
But this is just a suggestion and the second link can be removed from .lycheeignore.

@xlai89 xlai89 marked this pull request as ready for review May 16, 2024 07:56
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

Successfully merging this pull request may close these issues.

[LOVE] Add automatic link checking to our docs
2 participants