Michael-F-Bryan / mdbook-linkcheck

A backend for `mdbook` which will check your links for you.
https://michael-f-bryan.github.io/mdbook-linkcheck/
MIT License
144 stars 29 forks source link

NotInSummary wrongly reported if `-f` option is used #86

Open marxin opened 4 months ago

marxin commented 4 months ago

I noticed that while debugging the https://rustc-dev-guide.rust-lang.org/ documentation that utilizes -f option for files modified against the master branch.

The problematic invocation:

❯ RUST_LOG=info ~/Programming/mdbook-linkcheck/target/debug/mdbook-linkcheck -f profile-guided-optimization.md -f SUMMARY.md -s 
[2024-07-23T15:46:06Z INFO  mdbook_linkcheck] Started the link checker
[2024-07-23T15:46:06Z INFO  mdbook_linkcheck] Scanning book for links
[2024-07-23T15:46:06Z INFO  mdbook_linkcheck] Found 9 links (0 incomplete links)
[src/validate.rs:86:22] file_names = [
    "profile-guided-optimization.md",
]
[src/validate.rs:95:13] resolved_link = "llvm-coverage-instrumentation.md"
[src/validate.rs:96:13] summary_path = "profile-guided-optimization.md"
error: It looks like "llvm-coverage-instrumentation.md" wasn't included in SUMMARY.md
   ┌─ profile-guided-optimization.md:52:1
   │
52 │ [`-C instrument-coverage`](./llvm-coverage-instrumentation.md), but using these
   │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ It looks like "llvm-coverage-instrumentation.md" wasn't included in SUMMARY.md

error: Server returned 404 Not Found for https://github.com/rust-lang/rust/tree/master/tests/run-make-fulldeps
    ┌─ profile-guided-optimization.md:130:4
    │
130 │ in [run-make tests][rmake-tests] (the relevant tests have `pgo` in their name).
    │    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Server returned 404 Not Found for https://github.com/rust-lang/rust/tree/master/tests/run-make-fulldeps

[2024-07-23T15:46:06Z INFO  mdbook_linkcheck] 2 broken links found
Error: One or more incorrect links

The problem is that llvm-coverage-instrumentation.md is not included in file_names (contains only the filtered file) passed as argument to ensure_included_in_book. And thus the warning is triggered.

camelid commented 3 months ago

cc #77