MCPcopy Create free account
hub / github.com/OWASP/APTS / main

Function main

scripts/check_internal_markdown_links.py:70–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68
69
70def main() -> int:
71 markdown_files = git_ls_files("*.md")
72
73 if not markdown_files:
74 print("No Markdown files found. Skipping internal link validation.")
75 return 0
76
77 failed = False
78
79 for path in markdown_files:
80 markdown_text = strip_fenced_code(read_text(path))
81
82 for target in extract_link_targets(markdown_text):
83 resolved_path = resolve_local_target(path, target)
84 if resolved_path is None:
85 continue
86
87 if not resolved_path.exists():
88 print(
89 f"FAILED: {display_path(path)}: internal link target not found: {target}"
90 )
91 failed = True
92
93 return 1 if failed else 0
94
95
96if __name__ == "__main__":

Calls 6

git_ls_filesFunction · 0.90
strip_fenced_codeFunction · 0.90
read_textFunction · 0.90
display_pathFunction · 0.90
extract_link_targetsFunction · 0.85
resolve_local_targetFunction · 0.85

Tested by

no test coverage detected