Minor whitespace changes relating to lines of code that are being changed

Stephan Bergmann stephan.bergmann at allotropia.de
Thu Feb 13 13:18:47 UTC 2025


On 13.02.25 11:36, Chris Sherlock wrote:
> I see commits all the time where someone changes a line of code and changes the whitespacing in that same line of code.

I occasionally see such too, and always wonder why people do that.  My 
objections are twofold:

For one, unnecessary and unrelated changes are distractions when looking 
at a commit.  When a commit wants to do X, then it should do that, but 
not also randomly add or remove whitespace here and there, even in lines 
it touches for other reasons.  There are cases where every little iota 
counts when you look at a commit, so do others a favor and keep your 
commits simple.

And for another, what is the benefit of such random whitespace changes? 
The code is readable, before and after.  Everybody has their preferred 
style rules, and we have to be able to cope with a mix of styles anyway. 
  The goal should not be that the code is formatted according to the 
preferred style of programmer A (and then programmer B comes along and 
reformats lines according to their preferences)---the goal should rather 
be that the code is roughly readable and understandable.  (To paraphrase 
an example from the original PragProg book:  Mechanical workers also 
don't spend time making their power drills look beautiful.  It's tools 
for them that need to get their job done in a professional way, but it's 
irrelevant that they may look patched and ugly.)

That's my take on it.  Of course, YMMV



More information about the LibreOffice mailing list