-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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(husky): check deletions and broken fragments in URLs #31265
Conversation
Preview URLs
External URLs (1)URL:
(comment last updated: 2024-01-09 04:17:00) |
How fast is this? Anything run in Husky shouldn't take more than a few milliseconds. |
In my setup it takes less than 3 seconds. |
This pull request has merge conflicts that must be resolved before it can be merged. |
a57be99
to
8c2d0b3
Compare
"less than 3 seconds" still sounds like a lot, though, compared to Prettier. Does it depend on the input files? The key thing about lint-staged is that it's only supposed to care about those particular files, but if the performance is irrelevant of the input size then I think it should be CI-only. |
It is worse case time taken only if you've deleted a file or modified a markdown header, which we don't do that often. :O Yes it does depend on input files (taken from
The It is a small prices to pay to eliminate the broken fragments and broken links. At the moment there are thousands of such issues in content. Trust me you don't want to fix these later manually one by one. Should we also add |
8c2d0b3
to
9924c10
Compare
Again, a precommit hook should not take more than a few milliseconds for one or two modified files. I have no comments for Yari—it is already a mess in terms of architecture in my eyes. But let's not make development worse for everyone working on content, which is a 10x larger body. People come from different environments and have different git habits. Many people are accustomed to "commit small and often" and we need to make the process smooth for them without forcing them to turn off precommit hooks, which defeats the purpose. Again, unless the problem is either immediately detectable or autofixable, my opinion is to defer it to the CI. CI exists so one doesn't have to duplicate the check on their own machine. |
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.
r+ for the text changes
FWIW, just before I remove myself as a reviewer ...
|
files/en-us/mdn/writing_guidelines/page_structures/syntax_sections/index.md
Show resolved
Hide resolved
@OnkarRuikar I'm not the right person to review technical changes, so have requested a review from mdn/yari-content-mozilla-add-ons |
482594d
to
5ea6479
Compare
Yes, it's about just the fragments.
I've changed it to |
If it is going to take a while before this PR is merged, then I recommend splitting the content fixes from the CI automation introduced here.
I usually add/review content in WebExtensions documentation, and there is only one-character trivial fix for that in this PR. While I have the skills to evaluate the PR code, I am not sure if I have the authority to sign off on the addition of CI scripts. Therefore I'll remove myself a reviewer. Feel free to add me back if needed. |
Anybody against merging this? If not, I'll move forward later this week. |
So far the only approvals are in the changed documentation. The PR has not received any review of the actual code, so I don't think that all of the PR is ready to merge. I recommend looking for someone who has the skills and authority to sign off on code changes. If nobody is available for that, I am willing to offer a code review in this case to unblock the PR. |
What's the best way to test this? Check out the branch, stage some files with broken URL fragments in xrefs and try to commit? |
You'll have to do something like following:
|
It worked locally on my side. Let's merge this as we are at the beginning of the week. |
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.
👍
The PR adds following features:
a. Detects file deletions and checks if corresponding slugs are being used in rest of the content. Logs the files, line, column, and message.
b. Detects markdown header updates and reports any URL fragments in content that refers the headers.
Above features are enforced in following way:
a.
andb.
features mentioned above during precommit and fails if any cases found.b.
. Tags broken places in content and fails the workflow. Demo PR for this can be found here.ping @teoli2003