(token: str, line: int)
| 5939 | }) |
| 5940 | |
| 5941 | def _add_doc_ref(token: str, line: int) -> None: |
| 5942 | # Normalize "adr 11" / "ADR-0011" spellings to a canonical "ADR-0011" |
| 5943 | # style label so references to the same document collapse to one node. |
| 5944 | kind, num = re.match(r"([A-Za-z]+)[- ]?(\d+)", token).groups() |
| 5945 | kind = kind.upper() |
| 5946 | label = f"{kind}-{num.zfill(4)}" if kind == "ADR" else f"{kind}-{num}" |
| 5947 | if label in seen_doc_refs: |
| 5948 | return |
| 5949 | seen_doc_refs.add(label) |
| 5950 | rid = _make_id("docref", label) |
| 5951 | if rid not in seen_ids: |
| 5952 | seen_ids.add(rid) |
| 5953 | nodes.append({ |
| 5954 | "id": rid, |
| 5955 | "label": label, |
| 5956 | "file_type": "doc_ref", |
| 5957 | "source_file": str_path, |
| 5958 | "source_location": f"L{line}", |
| 5959 | }) |
| 5960 | edges.append({ |
| 5961 | "source": file_nid, |
| 5962 | "target": rid, |
| 5963 | "relation": "cites", |
| 5964 | "confidence": "EXTRACTED", |
| 5965 | "source_file": str_path, |
| 5966 | "source_location": f"L{line}", |
| 5967 | "weight": 1.0, |
| 5968 | }) |
| 5969 | |
| 5970 | for lineno, line_text in enumerate(source_text.splitlines(), start=1): |
| 5971 | stripped = line_text.strip() |
no test coverage detected