in sapp/ui/issues.py [0:0]
def similarity_with(self, other: object) -> SimilarIssue:
if not isinstance(other, type(self)):
raise NotImplementedError
score: float = 0.0
score += 1 if self.source_names == other.source_names else 0
score += 1 if self.sink_names == other.sink_names else 0
score += 1 if self.code == other.code else 0
score += 1 if self.callable == other.callable else 0
score += 2 * len(self.sink_kinds.intersection(other.sink_kinds))
score += 2 * len(self.source_kinds.intersection(other.source_kinds))
score = score / (
4
+ len(self.sink_kinds)
+ len(other.sink_kinds)
+ len(self.source_kinds)
+ len(other.source_kinds)
)
return SimilarIssue(issue_id=other.issue_id, score=score)