Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3485,15 +3485,16 @@ def violates_sla(self):
def set_hash_code(self, dedupe_option):
from dojo.utils import get_custom_method # noqa: PLC0415 circular import
if hash_method := get_custom_method("FINDING_HASH_METHOD"):
deduplicationLogger.debug("Using custom hash method")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is for debug, is there any value in including the method name (either from the given setting or by stringifying the resolved method)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@valentijnscholten Before I approve and merged this I wanted to give you a chance to comment here.

hash_method(self, dedupe_option)
# Finding.save is called once from serializers.py with dedupe_option=False because the finding is not ready yet, for example the endpoints are not built
# It is then called a second time with dedupe_option defaulted to true; now we can compute the hash_code and run the deduplication
elif dedupe_option:
if self.hash_code is not None:
deduplicationLogger.debug("Hash_code already computed for finding")
deduplicationLogger.debug("Hash_code already computed for finding %i", self.id)
else:
self.hash_code = self.compute_hash_code()
deduplicationLogger.debug("Hash_code computed for finding: %s", self.hash_code)
deduplicationLogger.debug("Hash_code computed for finding %i: %s", self.id, self.hash_code)


class FindingAdmin(admin.ModelAdmin):
Expand Down