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

Function get_affected_flows

code_review_graph/flows.py:658–698  ·  view source on GitHub ↗

Find flows that include nodes from the given changed files. Returns:: { "affected_flows": [ ], "total": , }

(
    store: GraphStore,
    changed_files: list[str],
)

Source from the content-addressed store, hash-verified

656
657
658def get_affected_flows(
659 store: GraphStore,
660 changed_files: list[str],
661) -> dict:
662 """Find flows that include nodes from the given changed files.
663
664 Returns::
665
666 {
667 "affected_flows": [<flow dicts>],
668 "total": <int>,
669 }
670 """
671 if not changed_files:
672 return {"affected_flows": [], "total": 0}
673
674 # Find node IDs belonging to changed files.
675 node_ids = store.get_node_ids_by_files(changed_files)
676
677 if not node_ids:
678 return {"affected_flows": [], "total": 0}
679
680 # Find flow IDs that contain any of these nodes.
681 flow_ids = store.get_flow_ids_by_node_ids(node_ids)
682
683 if not flow_ids:
684 return {"affected_flows": [], "total": 0}
685
686 affected: list[dict] = []
687 for fid in flow_ids:
688 flow = get_flow_by_id(store, fid)
689 if flow:
690 affected.append(flow)
691
692 # Sort by criticality descending.
693 affected.sort(key=lambda f: f.get("criticality", 0), reverse=True)
694
695 return {
696 "affected_flows": affected,
697 "total": len(affected),
698 }

Calls 4

get_flow_by_idFunction · 0.85
get_node_ids_by_filesMethod · 0.80
getMethod · 0.80