|
Ran
|
Files
26
|
Run time
–
|
Badge
README BADGES
|
push
travis-ci
Use diff-lcs gem for diffing Textual diffing tools allow you to easily understand when code is inserted or deleted without showing everything after that bit as having been changed. This problem is known as the longest common subsequence problem. As pages change, they often have elements added or removed that cause much of the page to be pushed down or moved up, but this content hasn't actually changed. With the way we are currently computing diffs, everything following this common type of change will appear as having changed, making the diff difficult to read and less valuable. We would like our visual diffs to work more like textual diffs. To that end, we are bringing in the diff-lcs gem, which implements diff algorithms in a convenient Ruby gem. We use this gem by first converting the before and after images into arrays of arrays of integers that represent the color of each pixel. These arrays are then sent to the diff-lcs gem to generate an sdiff. This returns a new object that represents the difference between the two images, where each row is either the same, added, deleted, or changed. We take this information to render a new diff where added lines are highlighted in green, deleted lines are highlighted in red, and changed lines are highlighted in hot pink. Because the diff-lcs gem has implemented the standard diff algorithm, it actually does a pretty good job of managing content that was added without counting the rest of the page as a diff. In practice, this works really well for single-column content, but not super great for multi-column content. Resolves #63. Change-Id: I6c81e4132
490 of 508 relevant lines covered (96.46%)
27.7 hits per line
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
|---|