-
Notifications
You must be signed in to change notification settings - Fork 6
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
[#218] Change redirects default behaviour #233
Conversation
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.
Looks good, thank you 👍
Leaving a couple of insignificant concerns, and a medium one.
Also, if you claim you resolve #218, it should be appropriate to add a test. We will touch the redirection logic a lot in the next PRs, and there is a chance to forget about #218 and leave no way to handle that issue. Feel free to resolve this here or in a separate pull request (in the latter case, you can leave |
Oh, and one more thing: make sure to fit commit descriptions into 80 characters. |
6f8e690
to
628e45a
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.
Nice to see tests added 👍 I think you can add a tick to the PR description.
Leaving one more comment, would like to know your opinion.
"http://127.0.0.1:5000/redirect" | ||
(Just "http://127.0.0.1:5000/other") | ||
(VerifyResult [PermanentRedirectError "http://127.0.0.1:5000/redirect" (Just "http://127.0.0.1:5000/other")]) | ||
] |
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.
This is only my opinion, but I believe there is no reason to provide that high coverage, since e.g. handling of 302
and 303
in the code is exactly the same. E.g. having 302 w/ loc, 302 w/o loc, 307 w/ loc would be sufficient to cover the temporary redirects.
Using formal terms, we don't usually practice automated "black box" testing when the implementation is only one and concrete.
What do you think?
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.
I think that it's OK to check all the possible variants. But it seems that the way these tests are written is a bit verbose. We could for example make a separate function which tests two options (location present/absent) for a given code, and pass to this function as a parameter whether these tests should succeed or not. I believe that the code will get much shorter this way.
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.
If test cases can be turned into one- or two-liners, that approach sounds good.
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.
If we are not doing "black box" testing that is right, the three cases mentioned by @Martoon-00 would provide enough coverage. However, let's try to cover all the possible variants with a more concise style.
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.
Looks nice 👍
@aeqz The comment of @YuriRomanowski seems to be also addressed, so in theory, you can merge this PR. But indeed it is better to wait for his approval or a "feel free to merge without my approval" message. |
Don't forget to squash your commits after @YuriRomanowski's review is finished, as the 2nd and 3rd seem to be just additions to the 1st commit. |
ae0094c
to
bf74b27
Compare
Problem: Xrefcheck currently always follows redirect links. Solution: We are changing its default behaviour regarding redirect links to fail and report permanent redirects, and to pass for temporary redirects. Further PRs will allow the user to configure other policies.
bf74b27
to
9c5f5f8
Compare
Description
Problem: Xrefcheck currently always follows redirect links.
Solution: We are changing its default behaviour regarding redirect links to fail and report permanent redirects, and to pass for temporary redirects. Further PRs will allow the user to configure other policies.
Related issue(s)
Fixes #218
Relates #25
✅ Checklist for your Pull Request
Ideally a PR has all of the checkmarks set.
If something in this list is irrelevant to your PR, you should still set this
checkmark indicating that you are sure it is dealt with (be that by irrelevance).
Related changes (conditional)
Tests
silently reappearing again.
Documentation
Public contracts
of Public Contracts policy.
and
Stylistic guide (mandatory)