Skip to main content

check_consistency

Function check_consistency 

Source
pub fn check_consistency(
    env: &BuildEnvironment,
    is_sphinx_source: &dyn Fn(&str) -> bool,
) -> Vec<ConsistencyMessage>
Expand description

Post-read consistency checks over the finished toctree graph.

Port of BuildEnvironment.check_consistency (environment/__init__.py:797-823) and the _check_toc_parents (:942-960) it calls: every document that no toctree reaches gets document isn't included in any toctree, and every document reachable from more than one gets an informational note (Sphinx uses logger.info there, so it must not count toward -W).

Not ported: the env-check-consistency event and the per-domain check_consistency hooks, neither of which exists yet.

is_sphinx_source answers, per docname, whether the file it came from carries a suffix Sphinx’s source_suffix covers. This crate’s discovery is deliberately wider than Sphinx’s — it admits .md and .txt alongside .rst, where Sphinx’s default source_suffix is {'.rst': 'restructuredtext'} (config.py:243, project.py:49-88) — and the orphan warning is the one check where that difference is user-visible: a README.md sitting in the source tree would earn a toc.not_included warning Sphinx never emits, failing -W on a build Sphinx passes. Everything else keeps treating those files as documents; full source_suffix semantics arrive with MyST in wave 6.