-
Notifications
You must be signed in to change notification settings - Fork 37.8k
ci: add markdown link check job #30034
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
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Without #30025 (or alternative fix) the new action being added here will fail. |
80d166b
to
b6be80c
Compare
b6be80c
to
ffc691a
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
ffc691a
to
961a536
Compare
961a536
to
9d2a8a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
utACK 9d2a8a8 with or without the nits |
9d2a8a8
to
82c5f95
Compare
Thanks @maflcko , did a final force-push for that silly nit: Sorry to invalidate the ACK |
utACK 82c5f95 Thanks! |
crACK 82c5f95 I tested by manually breaking relative and absolute offline links and verifying that the lint runner catches them. Some notes:
|
Right, the pull here does not change that. I'd say, it is best to only run the linters locally in a sandbox, or at least skip the optional dependencies. |
@@ -37,6 +37,7 @@ Then you can use: | |||
| [`lint-python-dead-code.py`](/test/lint/lint-python-dead-code.py) | [vulture](https://github.com/jendrikseipp/vulture) | |||
| [`lint-shell.py`](/test/lint/lint-shell.py) | [ShellCheck](https://github.com/koalaman/shellcheck) | |||
| [`lint-spelling.py`](/test/lint/lint-spelling.py) | [codespell](https://github.com/codespell-project/codespell) | |||
| markdown link check | [mlc](https://github.com/becheran/mlc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK on additional checks.
Could this have been an individual python lint script like the other ones in /test/lint/
? I appreciated being able to run individual python scripts locally to check my work or when reviewing. It seems we have been losing that recently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure it could be, but as I see it would need us to write our own markdown parser and link checker.
I don't have the appetite for that myself, hence this approach.
Also see #29965 which may (I didn't fully check yet) permit you to run this lint individually in the future :)
82c5f95
to
838eace
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-ACK 838eace
This adds a markdown hyperlink check task to the lint test_runner. It relies on having the [`mlc`](https://crates.io/crates/mlc) binary found on $PATH, but will fail with `success` if the binary is not found. `mlc` is also added to the ci/04_install.sh script run by the containerfile. Note that broken markdown hyperlinks will be detected in untracked markdown files found in a dirty working directory (including e.g. .venv).
838eace
to
4b7d984
Compare
re-utACK 4b7d984 |
reACK 4b7d984 Looks great! Tested with the following diff: diff --git a/test/lint/README.md b/test/lint/README.md
index 49ed8356c3..47ac472aa6 100644
--- a/test/lint/README.md
+++ b/test/lint/README.md
@@ -36,7 +36,7 @@ Then you can use:
| [`lint-shell.py`](/test/lint/lint-shell.py) | [ShellCheck](https://github.com/koalaman/shellcheck)
-| [`lint-spelling.py`](/test/lint/lint-spelling.py) | [codespell](https://github.com/codespell-project/codespell)
+| [`lint-spelling.py`](/test/lint/lint-spling.py) | [codespell](https://github.com/codespell-project/codespell)
| markdown link check | [mlc](https://github.com/becheran/mlc) And the linter complained$ cargo run
# [...]
One or more markdown links are broken.
Relative links are preferred (but not required) as jumping to file works natively within Emacs.
Markdown link errors found:
[Err ] ./test/lint/README.md (39, 3) => /test/lint/lint-spling.py - Target filename not found.
^---- ⚠️ Failure generated from markdown hyperlink check! |
After conducting Guix builds, |
Oh I didn't consider this directory! I think it should be possible to add |
This was what I tried before writing my comment :) It doesn't work, unfortunately. |
Ah, that is unfortunate. I will try and find another option... |
I think an upstream PR may be the best approach here, So I opened becheran/mlc#89 |
Not sure if globbing is the right fix. Conceptually, no folder or file should be scanned that is not tracked in git. Though, I wonder if there is an easy way to ask git to print all files/folders that are "dirty", ignoring the gitignore. An alternative may be to teach mlc to read understand the gitignore files. However, that will also be incomplete, because devs may add random other folders themselves. So for now the only solution would be to call |
This was a. bit of a pain (and prob not worth it!) but seems to work: becheran/mlc@master...willcl-ark:mlc:git-aware Passing the glob symbols to the subcommand in Rust was ... tricky, or a skill issue. So I went for a script which matches md (and html, which is the other thing this tool seems to do) against @maflcko do you think this hits the correct files? I think |
Ah sorry. I guess I was using the wrong words. With "dirty" I meant folders/files that should be ignored, but are not according to the gitignore. Maybe "untracked" is a better word, which is also used by |
|
Thanks, I changed the approach in https://github.com/willcl-ark/mlc/tree/git-aware to use I will investigate if I can have a i) a single file or ...I think |
Potential followup to: #30025
This should prevent us reintroducing broken markdown links.
It does not test "online" (external) links, only those within this repo. Both relative and absolute links are parsed successfully if they resolve.