MCPcopy Index your code
hub / github.com/tirth8205/code-review-graph / _compute_signatures

Function _compute_signatures

code_review_graph/postprocessing.py:55–84  ·  view source on GitHub ↗

Compute human-readable signatures for nodes that lack one.

(
    store: GraphStore,
    result: dict[str, Any],
    warnings: list[str],
)

Source from the content-addressed store, hash-verified

53
54
55def _compute_signatures(
56 store: GraphStore,
57 result: dict[str, Any],
58 warnings: list[str],
59) -> None:
60 """Compute human-readable signatures for nodes that lack one."""
61 try:
62 rows = store.get_nodes_without_signature()
63 for row in rows:
64 node_id, name, kind, params, ret = (
65 row[0],
66 row[1],
67 row[2],
68 row[3],
69 row[4],
70 )
71 if kind in ("Function", "Test"):
72 sig = f"def {name}({params or ''})"
73 if ret:
74 sig += f" -> {ret}"
75 elif kind == "Class":
76 sig = f"class {name}"
77 else:
78 sig = name
79 store.update_node_signature(node_id, sig[:512])
80 store.commit()
81 result["signatures_computed"] = len(rows)
82 except (sqlite3.OperationalError, TypeError, KeyError) as e:
83 logger.warning("Signature computation failed: %s", e)
84 warnings.append(f"Signature computation failed: {type(e).__name__}: {e}")
85
86
87def _rebuild_fts_index(

Callers 1

run_post_processingFunction · 0.85

Calls 3

update_node_signatureMethod · 0.80
commitMethod · 0.80

Tested by

no test coverage detected