Dealing with whitespace legacy in Eclipse projects

One of most annoying things during Gerrit reviews are “unnecessary whitespaces” change discussion. This applies for the contributors and the reviewers.

As we in the Eclipse platform.ui project currently see a flow incoming Gerrit reviews from various people, I want to minimize these issues to keep everyone involved in this process happy. Therefore I started to cleanup the existing whitespaces and a activate the save actions on the project to avoid the creation of new whitespace.

If you also would like to do this use Source -> Clean-up on your source folder and activate afterwards the “Remove unnecessary whitespace” save action via the project setting.

Eclipse can be instructed to ignore these changes in its blame annotations via the “Ignore whitespace changes” preference setting in Team -> Git.

With these changes you bite the bullet once but afterwards the Gerrit review process becomes much more enjoyable.

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of vogella.com. With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Eclipse, Lars Vogel. Bookmark the permalink.

3 Responses to Dealing with whitespace legacy in Eclipse projects

  1. Jérémie Bresson says:

    Have you a solution to check this in Gerrit and have some agent voting -1 if the rules are broken?

  2. Lars Vogel says:

    @Jérémie, I’m unaware of such a plug-in.

  3. Leo Ufimtsev says:

    Interesting that you mention this.

    We previously cleared white spaces from the swt GTK code base,
    We now have task to clear it out from SWT alltogether after M7:
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=458808

    Interesting proposition by Jérémie Bresson btw.

Comments are closed.