Difftastic: Syntax-aware structured diff tool
21–30 of 62 posts
Re: Difftastic: Syntax-aware structured diff tool
#22My favorite diff tool is the one shipped with Plastic SCM, Xdiff. Since it's visual, it makes it very easy to see what changes have been done to the file. https://www.plasticscm.com/features/xmerge
Re: Difftastic: Syntax-aware structured diff tool
#23Re: Difftastic: Syntax-aware structured diff tool
#24I love `mypy --strict` but it produces way too much noise with all the other code, so I've been using a tool I made that runs mypy over the changed files and then greps the output to filter for lines that `git diff` points out have changed. It's pretty rough and imperfect (doesn't catch errors that started appearing in unchanged files, or unchanged lines it the same file, for instance) but it's still quite helpful. I've been meaning to make an improved version that runs mypy over the branch point, then over my branch, and then maps new and changed lines between them so it displays all errors that are new, but I haven't gotten around to it yet. It'd be useful for other tools too, like semgrep.
Re: Difftastic: Syntax-aware structured diff tool
#25To ease the pain in conventional differs, we use a pre-commit hook to format the source code (prettier). This way we only see differences if something _actually_ changed.
This worsens the problem especially in templates when the nesting changes.
Re: Difftastic: Syntax-aware structured diff tool
#26This is cool. I work with a large Python codebase that's been around for a while (hasn't been that long since it's been completely off Python 2). It's not a bad codebase, but naturally it has almost no typing annotations, and other devs are just starting to come around to the idea. I love `mypy --strict` but it produces way too much noise with all the other code, so I've been using a tool I made that runs mypy over t…
It currently supports Python, Javascript, and Java. I like the idea of mypy changes, as well.
Re: Difftastic: Syntax-aware structured diff tool
#27To ease the pain in conventional differs, we use a pre-commit hook to format the source code (prettier). This way we only see differences if something _actually_ changed.
I think code formatting should be mandatory and one of the first things you adopt in your project. Resist code style rule changes as much as possible, and if you do, apply them across the whole codebase in one go to avoid churn and noise in diffs down the line. And if you do make style changes, put them in a separate commit at the very least so the diffs are cleaner and code reviews are easier. In my project I use go…
Re: Difftastic: Syntax-aware structured diff tool
#28Never really worked all that well. I looked for research on how to diff something like that but didn't find anything useful. IIRC the diff works by "serializing" the cell grid, effectively treating each cell as a separate "line" and then running that through a conventional line-based diff algorithm.
Re: Difftastic: Syntax-aware structured diff tool
#29I did not find any description of how your diffing algorithm works nor how you represent a patch. I'd be really curious to know more.
Re: Difftastic: Syntax-aware structured diff tool
#30I wrote diffr [0] for that purpose; it serves me well, especially if your team makes code with long lines. In my opinion, a simple approach that does NOT make any parsing is more efficient (what about bugs in your parser? code with syntax errors? also, how fast would the parser be?) [0]: https://github.com/mookid/diffr