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

Correctly show matches when the token order is not line index order #971

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

tsaglam
Copy link
Member

@tsaglam tsaglam commented Mar 13, 2023

In some cases, the first and last tokens of a match are not the first or last elements of the match in the source code. This happens e.g. when:

  • view files are used, as in the EMF language module
  • the code is normalized before parsing for obfuscation detection
  • in rare edge cases, even in normal language modules, e.g., regarding if/else/end-if/try/catch, etc.

In these cases, JPlag was not able to correctly display the matches in the report viewers. This PR fixes this by comparing the line indices of all tokens of a match.

@tsaglam tsaglam added bug Issue/PR that involves a bug minor Minor issue/feature/contribution/change report-viewer PR / Issue deals (partly) with the report viewer and thus involves web-dev technologies labels Mar 13, 2023
@tsaglam tsaglam marked this pull request as ready for review March 13, 2023 13:42
@sonarcloud
Copy link

sonarcloud bot commented Mar 13, 2023

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

@tsaglam
Copy link
Member Author

tsaglam commented Mar 13, 2023

@smjonas this might help with the issues of showing matches for model instances.
@mbrdl this will probably fix the report viewer issues when enabling your normalization.

@tsaglam tsaglam requested a review from a team March 13, 2023 14:26
@smjonas
Copy link
Contributor

smjonas commented Mar 15, 2023

Thanks for working on this! Unfortunately, after rebuilding JPlag with your commit I am still seeing the same issues as before (no highlighting in the report viewer for both language modules).

@sebinside sebinside merged commit 7a3bab2 into develop Mar 28, 2023
@sebinside sebinside deleted the feature/token2file-order branch March 28, 2023 14:19
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 report-viewer PR / Issue deals (partly) with the report viewer and thus involves web-dev technologies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants