Skip to content

Commit edc34bb

Browse files
reimport: remove fallback to non-batch
1 parent daac9c8 commit edc34bb

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

dojo/importers/default_reimporter.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -550,27 +550,23 @@ def match_finding_for_reimport(
550550
deduplicationLogger.debug("matching finding for reimport using algorithm: %s", self.deduplication_algorithm)
551551

552552
if self.deduplication_algorithm == "hash_code":
553-
if candidates_by_hash is None:
554-
# Fallback to individual query if candidates not provided
555-
return self.match_new_finding_to_existing_finding(unsaved_finding)
556-
if unsaved_finding.hash_code is None:
553+
if candidates_by_hash is None or unsaved_finding.hash_code is None:
557554
return []
558555
matches = candidates_by_hash.get(unsaved_finding.hash_code, [])
559556
return sorted(matches, key=lambda f: f.id)
560557

561558
if self.deduplication_algorithm == "unique_id_from_tool":
562-
if candidates_by_uid is None:
563-
# Fallback to individual query if candidates not provided
564-
return self.match_new_finding_to_existing_finding(unsaved_finding)
565-
if unsaved_finding.unique_id_from_tool is None:
559+
if candidates_by_uid is None or unsaved_finding.unique_id_from_tool is None:
566560
return []
567561
matches = candidates_by_uid.get(unsaved_finding.unique_id_from_tool, [])
568562
return sorted(matches, key=lambda f: f.id)
569563

570564
if self.deduplication_algorithm == "unique_id_from_tool_or_hash_code":
571-
if candidates_by_hash is None or candidates_by_uid is None:
572-
# Fallback to individual query if candidates not provided
573-
return self.match_new_finding_to_existing_finding(unsaved_finding)
565+
if candidates_by_hash is None and candidates_by_uid is None:
566+
return []
567+
568+
if unsaved_finding.hash_code is None and unsaved_finding.unique_id_from_tool is None:
569+
return []
574570

575571
# Collect matches from both hash_code and unique_id_from_tool
576572
matches_by_id = {}
@@ -589,10 +585,7 @@ def match_finding_for_reimport(
589585
return sorted(matches, key=lambda f: f.id)
590586

591587
if self.deduplication_algorithm == "legacy":
592-
if candidates_by_key is None:
593-
# Fallback to individual query if candidates not provided
594-
return self.match_new_finding_to_existing_finding(unsaved_finding)
595-
if not unsaved_finding.title:
588+
if candidates_by_key is None or not unsaved_finding.title:
596589
return []
597590
key = (unsaved_finding.title.lower(), unsaved_finding.severity)
598591
matches = candidates_by_key.get(key, [])

0 commit comments

Comments
 (0)