pub fn broken_references(
report: &ValidationReport,
) -> BTreeMap<&Utf8Path, Vec<String>>Expand description
Resolve every reference a report collected, keeping the ones that lead nowhere.
Keyed by the referring recipe, as ValidationReport::references is, and
carrying the references in the order that recipe writes them — so a recipe
making the same broken reference twice reports it twice. Recipes all of
whose references resolve are left out entirely, so an empty map means every
reference in the collection is good.
Every reference is resolved by [find::resolve_reference], the same way
the shopping list follows one: from ValidationReport::base_dir, the root
that was validated, except for a .., which steps up from the directory of
the recipe making it. A reference is judged by whether the collection
holds a recipe of that name, so one pointing outside the validated root is
broken however readable the file it lands on happens to be.
“Broken” is the whole of “could not be resolved to a readable recipe”: a reference naming a file that exists but cannot be opened counts, exactly as one naming nothing at all does. Reporting them apart would need a reason on every entry, which nothing has yet asked for.
Nothing here fails, so there is no Result: this is the check, and what it
finds is the answer. It does touch the filesystem, once per reference —
which is why it is a function rather than a method on the report.