homeport/dyff

Allow omitting whitespace only changes

clux opened this issue · 7 comments

clux commented

Hey all, thanks a lot for maintaining this great tool!

This is a feature request/suggestion for isWhitespaceOnlyChanges:

case isWhitespaceOnlyChange(from, to):
_, _ = output.WriteString(yellow("%c whitespace only change\n", MODIFICATION))
report.writeTextBlocks(output, 0,
red("%s", createStringWithPrefix(" - ", showWhitespaceCharacters(from))),
green("%s", createStringWithPrefix(" + ", showWhitespaceCharacters(to))),
)

It would be amazing to have a --omit-whitespace flag on dyff between.
WDYT?

Thanks for reaching out. So just that I do not misunderstand it, that would be similar to the GitHub compare feature where you can leave out whitespace changes from the diff to concentrate on the actual changes? Yes, that would make perfect sense.

clux commented

Yeah, that's what I was thinking. Currently dyff already identiifes the "whitespace only change" but then still always inlines those changes anyway. Would be good to focus on the important diff.

Created this functionality in my fork, aoktox#1 & aoktox#2

Not sure whether this is good enough to be merged in the upstream

I am currently slow to respond in my projects here, but I will definitely have a look.

I'm hitting on this currently, are you accepting PR's for this? @aoktox's change looks good but no pr is opened against this project, I can create my own if abandoned

+1, would love to see this as well!

Thank you everyone for your patience with this feature. It will be included in the next release. The flag is kind of a bit ironic, because one of the core reasons for this tool in the beginning was to detect trailing whitespaces in BOSH manifests. So in honor of BOSH manifests and for the sake of being backwards compatible, the default behavior will still be to show whitespace only changes.