4866: diff view to filter out reformatting changes


Describe the enhancement and the motivation for it.

Review requests often include reformatting changes that swamp any real changes. It would be useful to filter out these, and focus on any real changes that are made.

For example, a submitter changes a few lines to fix a bug in 1000-line C++ file. This is the real change. But also s/he runs clang-format on the entire file. It might reflect a new standard in the codebase, or a legacy file just undergoing a change since codebase's adoption of say, clang-format. These are the reformatting changes; and often being applied to the entire file, swamp the rest of the diffs, making it impossible at times to view the real changes.

A lot of codebases might do sweeping formatting-only submissions. Some codebases may not be able to - for instance due to qualification risks -; or simply want to be more nimble about any future changes to formatting.

How to Implement in RB

The diff result is based on the submission, which includes reformatting changes, and the baseline which does not.

A simple strategy could be to apply a common formatter to both the baseline and submission. The formatter itself does not need to be the exact one that the submitter used. It could be similar to any other front-end feature of the diff-viewer, such as syntax highlighting. There are front-end auto-formatters available.

This might be possible to implement as a reviewboard extension, but there does not seem to be one available at the moment.