Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions scripts/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ def check_latex_escapes(yaml_path):
return errors


def check_internal_links(yaml_path):
deployment = load(yaml_path.open(), Loader=Loader)
pairs = get_all_values_paths(deployment)
evidence_sources = deployment["deployment"]["administrative"].get(
"evidence_sources", {}
)
bracket_keys = {f"(#{k})" for k in evidence_sources.keys()}
errors = []
for path, text in pairs:
matches = re.findall(r"\(#.*?\)", str(text))
for m in matches:
if m not in bracket_keys:
errors.append(f"{path} contains unrecognized link {m}")
return errors


checks = {name for name in globals().keys() if name.startswith("check_")}


Expand Down
Loading