Skip to content
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

Allow ignoring specific broken links #133

Open
jyn514 opened this issue Dec 18, 2020 · 2 comments
Open

Allow ignoring specific broken links #133

jyn514 opened this issue Dec 18, 2020 · 2 comments
Assignees
Labels
C-enhancement Category: This is a new feature

Comments

@jyn514
Copy link
Contributor

jyn514 commented Dec 18, 2020

This is needed to replace src/tools/linkchecker in the rust-lang repo (#105). These are the currently ignored links: https://github.com/rust-lang/rust/blob/e4297ba39ce07a0b0000841b50154ea53783a024/src/tools/linkchecker/main.rs#L31-L91

So we need a way to ignore:

  1. Broken fragments
  2. Intra-doc like links ([<code></code>])
  3. and for both of those, ignore all links within a given file (https://github.com/rust-lang/rust/blob/e4297ba39ce07a0b0000841b50154ea53783a024/src/tools/linkchecker/main.rs#L60-L61)

I'm imagining a setup like this in deadlinks.toml:

[fragments]
"std/io/struct.IoSlice.html" = [
    "#method.as_mut_ptr",
    "#method.sort_by_key",
    "#method.make_ascii_uppercase",
    "#method.make_ascii_lowercase",
    "#method.get_unchecked_mut",
]

[intra_doc_links]
"reference/print.html" = all
"reference/comments.html" = [
     "/</code> <code>!",
     "*</code> <code>!",
]

The reason I don't want to put it in Cargo.toml is that allows it to be used with deadlinks and not just cargo-deadlinks.

As an extension, this could allow ignoring completely missing files, but that wouldn't be necessary for replacing linkchecker. I think it's a useful feature separate from rust-lang/rust, though.

@jyn514 jyn514 added the C-enhancement Category: This is a new feature label Dec 18, 2020
@jyn514 jyn514 mentioned this issue Dec 18, 2020
4 tasks
@jyn514
Copy link
Contributor Author

jyn514 commented Dec 19, 2020

These are the current broken links for the rust-lang/rust repo (after running a full x.py doc):

Found invalid urls in std/collections/btree_set/struct.BTreeSet.html:
	Fragment #insert-and-complex-keys at std/collections/btree_set/index.html does not exist!
Found invalid urls in std/collections/btree_map/struct.BTreeMap.html:
	Fragment #insert-and-complex-keys at std/collections/btree_map/index.html does not exist!
Found invalid urls in std/io/struct.IoSlice.html:
	Fragment #method.sort_by_key at std/io/struct.IoSlice.html does not exist!
	Fragment #method.as_mut_ptr at std/io/struct.IoSlice.html does not exist!
Found invalid urls in std/primitive.slice.html:
	Linked file at path /home/joshua/rustc3/build/x86_64-unknown-linux-gnu/std/primitive.slice.html does not exist!
	Linked file at path /home/joshua/rustc3/build/x86_64-unknown-linux-gnu/std/primitive.slice.html does not exist!
Found invalid urls in rust-by-example/print.html:
	Fragment #%E2%80%A0 at rust-by-example/print.html does not exist!
Found invalid urls in rust-by-example/error/result/enter_question_mark.html:
	Fragment #%E2%80%A0 at rust-by-example/error/result/enter_question_mark.html does not exist!
Found invalid urls in reference/types/tuple.html:
	Fragment #2 at reference/types/tuple.html does not exist!
Found invalid urls in reference/print.html:
	Fragment #2 at reference/print.html does not exist!
Found invalid urls in alloc/collections/btree_set/struct.BTreeSet.html:
	Fragment #insert-and-complex-keys at alloc/collections/btree_set/index.html does not exist!
Found invalid urls in alloc/collections/btree_map/struct.BTreeMap.html:
	Fragment #insert-and-complex-keys at alloc/collections/btree_map/index.html does not exist!
Found invalid urls in cargo/reference/build-script-examples.html:
	Fragment #%E2%80%A0 at cargo/reference/build-script-examples.html does not exist!
Found invalid urls in cargo/print.html:
	Fragment #%E2%80%A0 at cargo/print.html does not exist!

Of those, these seem like bugs in deadlinks itself:

Found invalid urls in rust-by-example/error/result/enter_question_mark.html:
	Fragment #%E2%80%A0 at rust-by-example/error/result/enter_question_mark.html does not exist!
Found invalid urls in reference/types/tuple.html:
	Fragment #2 at reference/types/tuple.html does not exist!

and this I'm not sure about:

Found invalid urls in std/primitive.slice.html:
	Linked file at path /home/joshua/rustc3/build/x86_64-unknown-linux-gnu/std/primitive.slice.html does not exist!

/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/doc/std/primitive.slice.html does exist so maybe someone used too many ../?

@jyn514
Copy link
Contributor Author

jyn514 commented Jan 18, 2021

After fixing bugs in both deadlinks and rust-lang/rust, these are the remaining broken links:

> deadlinks build/x86_64-unknown-linux-gnu/doc/
Found invalid urls in std/collections/btree_set/struct.BTreeSet.html:
	Fragment #insert-and-complex-keys at std/collections/btree_set/index.html does not exist!
Found invalid urls in std/collections/btree_map/struct.BTreeMap.html:
	Fragment #insert-and-complex-keys at std/collections/btree_map/index.html does not exist!
Found invalid urls in std/io/struct.IoSlice.html:
	Fragment #method.as_mut_ptr at std/io/struct.IoSlice.html does not exist!
	Fragment #method.sort_by_key at std/io/struct.IoSlice.html does not exist!
Found invalid urls in std/primitive.slice.html:
	Linked file at path /home/joshua/rustc/build/x86_64-unknown-linux-gnu/std/primitive.slice.html does not exist!
	Linked file at path /home/joshua/rustc/build/x86_64-unknown-linux-gnu/std/primitive.slice.html does not exist!
Found invalid urls in alloc/collections/btree_set/struct.BTreeSet.html:
	Fragment #insert-and-complex-keys at alloc/collections/btree_set/index.html does not exist!
Found invalid urls in alloc/collections/btree_map/struct.BTreeMap.html:
	Fragment #insert-and-complex-keys at alloc/collections/btree_map/index.html does not exist!

The link to slice looks related to #37, maybe? See also rust-lang/rust#80175.

jyn514 added a commit to jyn514/cargo-deadlinks that referenced this issue Jan 18, 2021
@jyn514 jyn514 self-assigned this Jan 18, 2021
jyn514 added a commit to jyn514/cargo-deadlinks that referenced this issue Jan 18, 2021
jyn514 added a commit to jyn514/cargo-deadlinks that referenced this issue Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: This is a new feature
Projects
None yet
Development

No branches or pull requests

1 participant