Skip to content

Commit fec1bf7

Browse files
authored
Merge pull request #931 from juanjemdIos/master
Fix over-merged values in canonicalization. Detected by Anas.
2 parents df18637 + eda7ee3 commit fec1bf7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/somef/export/json_export.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,10 @@ def canonicalize_value(value, value_type):
722722
clean_path = path
723723
return urlunparse((parsed.scheme, parsed.netloc, clean_path, '', '', ''))
724724

725+
domains_to_keep_path = ['github.com', 'api.github.com', 'gitlab.com', 'bitbucket.org']
726+
if any(d in parsed.netloc for d in domains_to_keep_path):
727+
return urlunparse((parsed.scheme, parsed.netloc, path, '', '', ''))
728+
725729
# It's a directory/page → unify to domain
726730
return f"{parsed.scheme}://{parsed.netloc}"
727731

@@ -776,6 +780,7 @@ def unify_results(repo_data: dict) -> dict:
776780
seen = {}
777781

778782
for item in items:
783+
779784
result = item.get(constants.PROP_RESULT, {})
780785
normalized_type = normalize_type(result)
781786
result[constants.PROP_TYPE] = normalized_type
@@ -785,7 +790,6 @@ def unify_results(repo_data: dict) -> dict:
785790
canonical = canonicalize_value(value, value_type)
786791

787792
key = str(canonical)
788-
789793
if key in seen:
790794
existing = seen[key]
791795

0 commit comments

Comments
 (0)