Open Havvy opened 5 years ago
Hi @Havvy. I'd like to give this one a try. Can you point me to the source code for the tool?
Okay, I guess https://github.com/rust-lang/rust/blob/7760cd0fbbbf2c59a625e075a5bdfa88b8e30f8a/src/tools/linkchecker/linkcheck.sh is what needs to be changed?
I cannot mentor here. I know nothing about how linkcheck works.
@Havvy alright, thanks anyway. I'm trying to compile src/tools/linkcheck
and do what I can, let's hope I can figure this out by myself in case nobody chimes in...
Okay, so I don't know yet where the diagnostics messages are emitted, but in src/tools/linkchecker/main.rs
there's a function called check
that takes a file path as an argument, reads the file and checks all the links in https://github.com/rust-lang/rust/blob/ec1f28f9614292c36b371d3758afffdd52cb9786/src/tools/linkchecker/main.rs#L172-L270. I guess a good first step would be to refactor this logic into a separate function? Maybe call it something like check_link
that just takes a string link as input?
This particular message is emitted at https://github.com/rust-lang/rust/blob/ec1f28f9614292c36b371d3758afffdd52cb9786/src/libcore/marker.rs#L83-L93.
@ryzokuken The linkchecker does not check external links (on purpose). External link checking in CI is prone to random errors, throttling, and other problems.
Also, there isn't really a way to extract error messages from the code base. One could possibly scan for all https://
links in all .rs
code, but care should be taken (for example, handling backslashes, angle brackets, etc.).
I'm not sure this is really feasible to do in an automated fashion in a reliable way. Perhaps a manual script could be built that would list all the links in .rs
code, and then feed that into a link checking tool. There are dozens out there. Some Rust projects are using mdbook-linkcheck, perhaps you could just dump the links into a .md
file and use that. I've also used https://github.com/linkchecker/linkchecker and a few others, but they all have their shortcomings.
I'm not sure this is really feasible to do in an automated fashion in a reliable way.
I think the E-needs-help label was added under the assumption that this would be straightforward to automate in a reliable way. Let's remove the label since that is not the case.
The linkcheck tool does not check that links emitted by diagnostics messages are correct. E.g. we have at least one wrong link as per issue #54555. It would be useful to have linkcheck be able to check those links.