MCPcopy
hub / github.com/yeasy/docker_practice / check_target

Function check_target

check_project_rules.py:146–159  ·  view source on GitHub ↗
(path: Path, raw_target: str, line_no: int)

Source from the content-addressed store, hash-verified

144
145
146def check_target(path: Path, raw_target: str, line_no: int) -> list[str]:
147 target = normalize_target(raw_target)
148 if not target or not is_local_target(raw_target):
149 return []
150 target_path = (path.parent / target).resolve()
151 try:
152 target_path.relative_to(ROOT)
153 except ValueError:
154 return []
155 if target_path.exists():
156 return []
157 return [
158 f"{path.relative_to(ROOT)}:{line_no}: missing local link target: {raw_target}"
159 ]
160
161
162def check_links(path: Path, text: str) -> list[str]:

Callers 1

check_linksFunction · 0.85

Calls 2

normalize_targetFunction · 0.85
is_local_targetFunction · 0.85

Tested by

no test coverage detected