Closed yiwen101 closed 6 months ago
It turns out that my code is good. All the 15 mismatches are actually legitimate broken links :(
I will fix all the broken links with hash in this PR as well. For ease of verification of reviewer, I will also post pictures of the positions of these broken hash links here:
<img width="663" alt="Screenshot 2024-03-19 at 15 35 39" src="https://github.com/M
arkBind/markbind/assets/121547057/c14aeb4a-e60e-42ed-98f5-92b96d25ebab">
Attention: Patch coverage is 63.63636%
with 20 lines
in your changes are missing coverage. Please review.
Project coverage is 51.11%. Comparing base (
9da549c
) to head (49236f8
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Efficient
Could you test with the cs2103T website to check the before & after timing of running markbind-serve/build
over a large website, to validate whether this solution is in practice efficient?
Efficient
Could you test with the cs2103T website to check the before & after timing of running
markbind-serve/build
over a large website, to validate whether this solution is in practice efficient?
Thanks for the comment, the following if the result on my end: valid-hash branch, intrasiteLinkValidation {enabled: true}
valid-hash branch, intrasiteLinkValidation {enabled: false}
master-branch, intrasiteLinkValidation {enabled: false}
The additional cost should be negligible, and literally invisible (as master branch in theory should run faster when all other factor hold constant, but it turns out run the slowest, suggesting that even the fluctuation in runtime caused by other factors has significantly higher impact than the runtime contributed by the changes)
The additional cost should be negligible, and literally invisible (as master branch in theory should run faster when all other factor hold constant, but it turns out run the slowest, suggesting that even the fluctuation in runtime caused by other factors has significantly higher impact than the runtime contributed by the changes)
👍
For your test run on 2103T website, how many valid intra-link hash errors were detected? Would be useful info for @damithc for follow-up broken link fixes.
Sorry for getting back to the review late; was overwhelmed by a hackathon due Friday this week
@kaixin-hc Thank you for the careful review and suggestions. Could you help elaborate further on how could I add this to test site? Current implementation of the functional test seems only adequate of recursively comparing the files in the expected folder and the actual files during the build process. I do not know how to "expect" error logs. The PR that brings in the intra-link validation feature also did not add functional test.
@EltonGohJH @yucheng11122017 Thank you for the careful review; I have made the requested changes and added method document.
The only exception is the "print" method in SitelinkManager. Although it is most for test purpose, I believe that it is a necessary evils and the best resort among all choices, so should leave it as it is.
@yucheng11122017 Thank you for your careful review and various suggestions on improving code quality.
In a later commit, I made following changes to existing methods to improve code quality. They are:
1 rename "processAndReturnHeadingId" back to "setHeadingId", and modify its behaviour accordingly.
2 remove the "forceWrite" from maintainFilePathToHashesMap
3 modify the maintainHashesForInclude accordingly.
I hope that the code becomes clearer after the changes.
What is the purpose of this pull request?
working on #1418
Overview of changes: Store all the elements with ids (accessible) in the siteLinkManager Validate intra-link with hash at the link processor; Fixes 15 detected invalid intra-link with hash in the current documentation.
This is a draft PR; has encountered issue and stuck when working on this issue, so I post my work so far to seek help.
Current implementation: 1 for nodes with node.attribs.ids, simply add to the collection in the siteLinkManager
2 for header tags, add to the collection in the siteLinkManager after they have been granted ids 3 for include nodes, after they have been processed, recursively add their and their children ids to the collection in the siteLinkManager; if they/their children are header tags, grant them ids with the same util method as in 2
Current issue: 1 some header added in step 3 seems to be off:
2 there are still some hashes missing, not collected:
Anything you'd like to highlight/discuss:
Testing instructions:
Proposed commit message: (wrap lines at 72 characters) Implement efficient validation for hash intra-link
Checklist: :ballot_box_with_check:
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major
,r.Minor
,r.Patch
.Breaking change release note preparation (if applicable):