Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add ability to recognize links to the same page #16994
Add ability to recognize links to the same page #16994
Changes from 27 commits
4e1f7cd
60dd50a
9d13634
445be6c
82d34be
e0ac8a8
253e576
eb01b6f
5cf585c
ba36a24
4c4d8e3
a965d2d
fae812b
cedfc69
362e583
549a40c
5e35313
13bf11d
bf290bb
b032b2e
c156c71
456facb
b483be6
a18de14
5efea77
f84d23e
ffad846
37c9bf4
d4b9ea2
69bd7e7
e207ca5
07ddb09
984a59e
90bbd12
4b21bb3
d602cbe
4fbe4cb
cd347d2
df22719
a0af6ee
d1c6286
af32760
65d82db
161b2fa
a2b1a88
f0cbcbe
9e767d2
48f1b61
db0c8cd
fab26cf
b91c8d2
0bcc928
4849e6b
bbce160
8fb71ca
d6d59f8
1fc8382
4e331d5
e526e25
0cb9b6b
19bcae9
ce7396b
1dab305
64cbf92
da60228
8eddd33
1529e2c
9dff709
30381ed
8620913
957d541
96d8462
aa83277
b8eb917
2ca89c0
18b0034
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
why not? this seems like unexpected behaviour?
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 this test is valid, since the target and root url are equal and then the page maybe refreshed, but the link target is not an anchor for the same page.
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.
Perhaps the function should be renamed then
isLinkToSamePageAnchor
or similar?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 really don't follow the logic on this one.
If I am on the page:
And there is a standard menu on that page with a link called "Contact Us", linking to:
I would expect that to say "Contact Us Link in-page link", or whatever the label for a same page link is.
This seems like the very definition of a same page link.
But this test is expected to fail, meaning that what I would anticipate is wrong.
Can you explain this more?
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 agree.
Either the concept is just for anchors, and we communicate it that way, or the concept is for same page links, which includes links to the exact same page.
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 concept is for same page links
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 should maybe be True? shouldn't these both return to the same page? someone may have opened a website directly to http, but the internal links redirect to https
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 agree with @seanbudd about this question. Let's ask to @coderabbitai
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.
@nvdaes, the current implementation of the
isSamePageUrl
function compares URLs without their fragments, but it includes the scheme (e.g.,http
vs.https
) in the comparison. This means that URLs with different schemes are not considered the same page, which is why thetest_differentScheme
test case currently assertsFalse
.If the desired behavior is to treat
http
andhttps
URLs as the same page, the function would need to be modified to ignore the scheme when comparing URLs. This change would align the function's behavior with the suggestion to returnTrue
for URLs with different schemes.Would you like to proceed with modifying the function to ignore the scheme, or should we keep the current behavior?
Analysis chain
Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 428
Script:
Length of output: 715
Script:
Length of output: 1483
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 want to modify this, but just when URLs start with http, not ftp, mailto etc.
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.