From bce4f9b9e5a11f305ed32dfbdbb7bcd30e1c69fc Mon Sep 17 00:00:00 2001 From: Lars Falk-Petersen Date: Fri, 29 Nov 2024 10:54:16 +0100 Subject: [PATCH] Add strict check for duplicate licenses. --- sedr/rodeoprofile10.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sedr/rodeoprofile10.py b/sedr/rodeoprofile10.py index bd38d97..3c563a9 100644 --- a/sedr/rodeoprofile10.py +++ b/sedr/rodeoprofile10.py @@ -200,6 +200,7 @@ def requirement7_5(jsondata: dict) -> tuple[bool, str]: spec_url = f"{spec_base_url}#_collection_license" wanted_type = "text/html" wanted_rel = "license" + license_count = 0 # A, B for link in jsondata["links"]: if link["rel"] == wanted_rel: @@ -209,13 +210,20 @@ def requirement7_5(jsondata: dict) -> tuple[bool, str]: f"Collection <{jsondata['id']}> license link should have " f"type='{wanted_type}'. See <{spec_url}> C for more info.", ) - break - else: + license_count += 1 + + if license_count > 1: + return ( + not util.args.strict, + f"Collection <{jsondata['id']}> has more than one license link.", + ) + elif license_count < 1: return ( False, f"Collection <{jsondata['id']}> is missing a license link with " f"rel='{wanted_rel}'. See <{spec_url}> A, B for more info.", ) + return ( True, "Collection license OK.",