Skip to content

Check all links to docs.rs in README are correct #72

@alecmocatta

Description

@alecmocatta

Neat project @mgeisler!

I often link to items in the docs at docs.rs in my README. I'd love to use this crate for checking the version of the docs linked is correct.

For example, at https://github.com/alecmocatta/palaver there are a bunch of links like https://docs.rs/palaver/0.2.8/palaver/thread/fn.gettid.html. I'd like to check that the 0.2.8 in the URL is in fact the current version.

I'm keen to hear what you think of this and how to approach it, but what I'm currently envisioning is something similar to assert_contains_regex, but rather than matching on a regex, the regex extracts strings which are compared with the current version.

A rough way this could work:

  • assert_matches_regex!("README.md", "https://docs\.rs/{name}/{version_match}/");
  • Runs a couple of extra replaces:
    • {name_match} => (?P<name>[^/]+)
    • {version_match} => (?P<version>[^/]+)
  • Regex::captures_iter, and the name and version capture groups if they exist are asserted to match the actual name and version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions