I am currently working on a source code generation tool. To make sure that my changes do no introduce any new bugs, a diff
between the output of the program before and after my changes would theoretically be a valuable tool.
However, this turns out to be harder than one might think, because the tool outputs lines where the order does not matter (like import
statements, function declarations, …) in a semi-randomly ordered way. Because of this, the output of diff
is cluttered with many changes that are in fact only lines moved to another position in the same file.
Is there a way to make diff ignore these moves and only output the lines that have really been added or removed?
diff
tool be able to separate valid moves from invalid ones, as Order of instructions in code does matter, and cases where this is not true are limited (imports, declaration of functions and classes, etc.) ?