[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:09:06 UTC 2024



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
7ec9db5d by Chris Lamb at 2024-09-23T17:08:36-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,8 +164,12 @@ 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"
                 yield prep_yield(my_name, other_name, comment)



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

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/7ec9db5d92d1d501274c89d214ddcbf5d5f7a6d5
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/fc7be6bb/attachment.htm>


More information about the rb-commits mailing list