@@ -270,50 +270,53 @@ def check_undefined_parents(sheets: list[SheetData]) -> list[QCIssue]:
270270 if "stub" in parent_ref .lower ():
271271 continue
272272
273- # Check if parent is defined (could be ID or label)
274- is_id = parent_ref .startswith ("METPO:" ) or ":" in parent_ref
275- is_label = not is_id
273+ # ROBOT templates use pipe-separated multiple parents (SPLIT=|)
274+ parent_parts = [p .strip () for p in parent_ref .split ("|" ) if p .strip ()]
276275
277- if is_id and parent_ref not in all_ids :
278- issues .append (
279- QCIssue (
280- "ERROR" ,
281- "UNDEFINED_PARENT_ID" ,
282- f"Parent ID '{ parent_ref } ' not defined anywhere" ,
283- f"{ sheet .filename } : row { row_num } , ID { id_val } " ,
276+ for part in parent_parts :
277+ # Check if parent is defined (could be ID or label)
278+ is_id = part .startswith ("METPO:" ) or ":" in part
279+ is_label = not is_id
280+
281+ if is_id and part not in all_ids :
282+ issues .append (
283+ QCIssue (
284+ "ERROR" ,
285+ "UNDEFINED_PARENT_ID" ,
286+ f"Parent ID '{ part } ' not defined anywhere" ,
287+ f"{ sheet .filename } : row { row_num } , ID { id_val } " ,
288+ )
284289 )
285- )
286- elif is_label and parent_ref not in all_labels :
287- issues . append (
288- QCIssue (
289- "WARNING " ,
290- "UNDEFINED_PARENT_LABEL " ,
291- f"Parent label ' { parent_ref } ' not defined anywhere (using labels for parents may cause issues) " ,
292- f" { sheet . filename } : row { row_num } , ID { id_val } " ,
290+ elif is_label and part not in all_labels :
291+ issues . append (
292+ QCIssue (
293+ "WARNING" ,
294+ "UNDEFINED_PARENT_LABEL " ,
295+ f"Parent label ' { part } ' not defined anywhere (using labels for parents may cause issues) " ,
296+ f" { sheet . filename } : row { row_num } , ID { id_val } " ,
297+ )
293298 )
294- )
295299
296- # Check for self-referential parents
297- # Get the label for this ID
298- current_label = sheet . ids . get ( id_val , ( None , None , None , None ))[ 1 ]
299- if parent_ref == id_val :
300- issues . append (
301- QCIssue (
302- "ERROR " ,
303- "SELF_REFERENTIAL_PARENT_ID " ,
304- "Parent references itself via ID " ,
305- f" { sheet . filename } : row { row_num } , ID { id_val } " ,
300+ # Check for self-referential parents
301+ current_label = sheet . ids . get ( id_val , ( None , None , None , None ))[ 1 ]
302+ if part == id_val :
303+ issues . append (
304+ QCIssue (
305+ "ERROR" ,
306+ "SELF_REFERENTIAL_PARENT_ID " ,
307+ "Parent references itself via ID " ,
308+ f" { sheet . filename } : row { row_num } , ID { id_val } " ,
309+ )
306310 )
307- )
308- elif parent_ref == current_label :
309- issues . append (
310- QCIssue (
311- "ERROR " ,
312- "SELF_REFERENTIAL_PARENT_LABEL " ,
313- f"Parent references itself via label ' { parent_ref } ' " ,
314- f" { sheet . filename } : row { row_num } , ID { id_val } " ,
311+ elif part == current_label :
312+ issues . append (
313+ QCIssue (
314+ "ERROR" ,
315+ "SELF_REFERENTIAL_PARENT_LABEL " ,
316+ f"Parent references itself via label ' { part } ' " ,
317+ f" { sheet . filename } : row { row_num } , ID { id_val } " ,
318+ )
315319 )
316- )
317320
318321 return issues
319322
0 commit comments