Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix similarity distribution in JPlagResult #794

Merged
merged 1 commit into from
Nov 16, 2022
Merged

Conversation

tsaglam
Copy link
Member

@tsaglam tsaglam commented Nov 15, 2022

This PR fixes a bug where the similarity distribution in JPlagResult deviated from the API specification.
The distribution was returned in reverse order (100% to 0% instead of 0% to 100%).

/**
* For the {@link SimilarityMetric#MAX} that is built in to every {@link JPlagComparison}, this returns the similarity
* distribution of detected matches in a 10-element array. Each entry represents the absolute frequency of matches whose
* similarity lies within the respective interval. Intervals: 0: [0% - 10%), 1: [10% - 20%), 2: [20% - 30%), ..., 9:
* [90% - 100%]
* @return the similarity distribution array. When JPlag was run with the {@link SimilarityMetric#MAX}, this will return
* the same distribution as {@link JPlagResult#getSimilarityDistribution()}
*/

@tsaglam tsaglam added bug Issue/PR that involves a bug minor Minor issue/feature/contribution/change labels Nov 15, 2022
@tsaglam tsaglam added this to the v4.0.1 milestone Nov 15, 2022
@sonarcloud
Copy link

sonarcloud bot commented Nov 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@JanWittler
Copy link
Contributor

JanWittler commented Nov 16, 2022

Code overall looks fine for me.
Why did you choose to reverse the similarity order for the JSON serialization instead of serializing in the "normal" order and simply inverting the displayed order in the report viewer? As a bonus, we could even add fallback for previous versions in the report viewer by inverting the distribution if a version tag of 4.0.0 is detected.

@tsaglam
Copy link
Member Author

tsaglam commented Nov 16, 2022

did you choose to reverse the similarity order for the JSON serialization instead of serializing in the "normal" order and simply inverting the displayed order in the report viewer?

To save time and not interfere with the report viewer student, but of course, that's a workaround, and in the long way, the report viewer should just display it the right way.

As a bonus, we could even add fallback for previous versions in the report viewer by inverting the distribution if a version tag of 4.0.0 is detected.

I like that, I will add it to the report viewer issue!

@tsaglam tsaglam merged commit ed3286d into develop Nov 16, 2022
@tsaglam tsaglam deleted the distribution-fix branch November 16, 2022 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue/PR that involves a bug minor Minor issue/feature/contribution/change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants