-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Detect relative urls in tidy check #43632
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Code looks good to me. @rust-lang/docs, can you think of any accidental ignores we'd add by doing this? I'd imagine this is fine... |
It seems good for me. |
src/tools/tidy/src/style.rs
Outdated
@@ -79,11 +79,11 @@ fn line_is_url(line: &str) -> bool { | |||
=> state = EXP_URL, | |||
|
|||
(EXP_LINK_LABEL_OR_URL, w) | |||
if w.starts_with("http://") || w.starts_with("https://") | |||
if w.starts_with("http://") || w.starts_with("https://") || w.starts_with("../") |
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.
Hmm, so this change will permit long lines anywhere that there is a word beginning with ../
. I'm not sure if this is what we want. Maybe it is, or maybe it's too accepting.
On the other hand, if we only keep the second change, below, then the [deref-coercions]:
link in the relevant PR would put us into the EXP_URL
state, and there we can accept ../
, where the context is a bit less ambiguous.
I could go either way, just saying that maybe we don't want this line.
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.
There is currently one line in the codebase which would be affected:
$ git grep -E '\s?//(/|!)?\s\.\./'
src/libstd/net/tcp.rs: /// ../../std/net/trait.ToSocketAddrs.html#tymethod.to_socket_addrs
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'm in favour of removing (though I think it's just the first word on a line, rather than any).
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.
Removed.
Yellow is indeed a nice color for a bikeshed.
r? @Mark-Simulacrum - @nikomatsakis is on vacation until Aug 15 |
@bors r+ rollup |
📌 Commit 608863d has been approved by |
…ark-Simulacrum Detect relative urls in tidy check This came up in rust-lang#43631: there can be long relative urls in Markdown comments, that do not start with `http://` or `https://`, so the tidy check will not detect them as urls and complain about the line length. This PR adds detection of relative urls starting with `../`.
…ark-Simulacrum Detect relative urls in tidy check This came up in rust-lang#43631: there can be long relative urls in Markdown comments, that do not start with `http://` or `https://`, so the tidy check will not detect them as urls and complain about the line length. This PR adds detection of relative urls starting with `../`.
This came up in #43631: there can be long relative urls in Markdown comments, that do not start with
http://
orhttps://
, so the tidy check will not detect them as urls and complain about the line length. This PR adds detection of relative urls starting with../
.