4

My project is in C#, which ignores whitespace, both spaces and in particular newlines.

When entering the diff view in Github, I know I can use the ?w=1 url parameter to ignore whitespace.

But it does not completely ignore whitespace. The line:

somethingLong + somethingAlsoLong

Gets transformed like this:

somethingLong +
somethingAlsoLong

I still get such changes showing up in the Github diff when my colleagues are reviewing it.

I understand such whitespace changes are meaningful in languages like Python but not in C#. Resharper liberally applies them, including line splitting.

Forcing a Resharper run on all files before they are committed would be better, but that does not happen often. When I make a change, I run Resharper over the file but it also hits functions that I did not change, therefore, polluting my commit.

The files probably should be normalized for spacing anyway but I'd prefer an option to ignore the meaningless whitespace changes (including newlines) when doing so. This is so the pull request diff view in GitHub shows my reviewers what I've really changed.

Is there a way to achieve this?

Noel Bahdy
  • 29
  • 4
Clinton
  • 20,913
  • 14
  • 64
  • 148

1 Answers1

1

If the online review is not satisfactory (here because of end of line diff), then a reviewer in your project will have to Check out pull requests locally.

Once checked out, a local diff can be done against the target branch, this time with diff tool able to ignore the difference between a+b and a\n+\nb.
That involves:

  • diff options (which would not be available through online GitHub alone)
  • or a semantic diff tool like SemanticMerge (non-free though)
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755