From 0603a8c7e685671de5493528b96e0c8f2559391f Mon Sep 17 00:00:00 2001 From: CroneKorkN Date: Mon, 1 Dec 2025 20:57:16 +0100 Subject: [PATCH] test unique node ids --- hooks/unique_node_ids.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 hooks/unique_node_ids.py diff --git a/hooks/unique_node_ids.py b/hooks/unique_node_ids.py new file mode 100644 index 0000000..450a830 --- /dev/null +++ b/hooks/unique_node_ids.py @@ -0,0 +1,14 @@ +def test_unique_node_ids(repo): + ids = {} + for node in repo.nodes: + if node.metadata.get('id') in ids: + raise ValueError(f"Duplicate node ID found: {node.metadata.get('id')} in node {node.name} and {ids[node.metadata.get('id')]}") + ids[node.metadata.get('id')] = node.name + + +def apply_start(repo, target, nodes, interactive=False, **kwargs): + test_unique_node_ids(repo) + + +def test(repo, **kwargs): + test_unique_node_ids(repo)