test unique node ids

This commit is contained in:
CroneKorkN 2025-12-01 20:57:16 +01:00
parent 5620c199a9
commit 0603a8c7e6
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw

14
hooks/unique_node_ids.py Normal file
View file

@ -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)