[Git][reproducible-builds/diffoscope][master] Correctly invert "X% similar" value and do not emit "100% similar". (Closes:...

Chris Lamb (@lamby) gitlab at salsa.debian.org
Tue Sep 24 00:08:17 UTC 2024



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
71c9b15e by Chris Lamb at 2024-09-23T17:07:18-07:00
Correctly invert "X% similar" value and do not emit "100% similar". (Closes: reproducible-builds/diffoscope#391)

- - - - -


1 changed file:

- diffoscope/comparators/utils/container.py


Changes:

=====================================
diffoscope/comparators/utils/container.py
=====================================
@@ -164,10 +164,15 @@ class Container(metaclass=abc.ABCMeta):
             for my_name, other_name, score in self.perform_fuzzy_matching(
                 my_members, other_members
             ):
-                score_display = score / 400.0 * 100
-                comment = f"Files {score_display:.0f}% similar despite different names"
+                percentage = (1 - (score / 400.0)) * 100
+                if percentage >= 99:
+                    percentage = 99
+                comment = (
+                    f"Files {percentage:.0f}% similar despite different names"
+                )
                 if score == 0:
                     comment = "Files identical despite different names"
+                print((score, comment))
                 yield prep_yield(my_name, other_name, comment)
 
             if Config().new_file:



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/71c9b15e12409ca049341097532080df2594eb18

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/71c9b15e12409ca049341097532080df2594eb18
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20240924/4a98b742/attachment.htm>


More information about the rb-commits mailing list