Skip to content

Fix and improve rearrange #44

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

Merged
merged 1 commit into from
Sep 25, 2021
Merged

Fix and improve rearrange #44

merged 1 commit into from
Sep 25, 2021

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Sep 25, 2021

Resolves #43.
Fixes #38.

This PR removes unnecessary keys stripping as suggested in #43 (comment).

Also it adds rearrangement criteria for non-scalar properties (only objects) using XOR hash.

Also it fixes XOR hash collision when having pairs of properties with similarities in name, e.g. hash of {"aX":1,"bX":1} was equal to hash of {"aY":1,"bY":1}.

@github-actions
Copy link

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
JSON 11 (+2) 3439 (+1230) 3421 (+1230) 0 18 0 83.1K (+50.9K)
Markdown 2 369 (+10) 261 (+7) 0 108 (+3) 0 11.2K (+323B)
PHP 34 3634 (+118) 2848 (+87) 270 (-1) 516 (+32) 200 (+1) 93.2K (+4.2K)

@codecov
Copy link

codecov bot commented Sep 25, 2021

Codecov Report

Merging #44 (9c3e873) into master (d223be0) will decrease coverage by 0.15%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
- Coverage   96.79%   96.63%   -0.16%     
==========================================
  Files          10       10              
  Lines         530      535       +5     
==========================================
+ Hits          513      517       +4     
- Misses         17       18       +1     
Impacted Files Coverage Δ
src/JsonDiff.php 96.20% <93.33%> (-0.40%) ⬇️
src/JsonHash.php 94.59% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d223be0...9c3e873. Read the comment docs.

@vearutop vearutop merged commit bb3e3b4 into master Sep 25, 2021
@vearutop vearutop deleted the fix-rearrange branch September 25, 2021 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removing an item from the array when option REARRANGE_ARRAYS is enabled Issue with comparing arrays
1 participant