Please mind your white space in Azure DevOps pull requests

The web interface for reviewing pull requests in Azure DevOps has two user interfaces for comparing files. If you’re not aware or careful while reviewing the files you could be unintentionally allowing undesirable changes to get introduced.

The first interface is shown by default and provides a concise view of all the included files their changes in one screen. While this is incredibly useful, the downside to this view is it doesn’t show all the changes to the files and it excludes showing many kinds of white space changes.

Here’s an example showing the first, default interface of all included files visible on one screen. It looks like there have been 2 changes, one in each file.

The second interface is used when clicking on an individual file, and it switches to a single file view showing the selected file’s full contents. When in this mode an extra preferences menu icon becomes available at the top right:

The menu for opening editor preferences

The editor preferences window has a Show and diff white space option and is unselected by default. Make sure to select this option to see all white space changes.

The preference to view white space diffs

With page-2.html selected and the show and diff white space preference enabled, we now see there are actually more changes to the file than previously depicted. Line 13 has extra spaces at the end of the line, and line 20 has a series of spaces in the empty line.

In real-world conditions where dozens of files and hundreds of changes are involved, the extra white space modifications can introduce many unnecessary or unintended modifications, causing the review to be more difficult, and raise the probability of merge conflicts occurring in the future.

Leave a comment