I hate the paranoia around trimming trailing whitespace.
I remember a time when people weren't pedantic about it.
It started with Linux kernel devs because of their patches-over-email development method (email lost whitespace)
Then Linus coded that pedantism into Git.
And it spread like wildfire: editors started painting trailing whitespace RED.
Now everyone HATES trailing whitespace and when I ask them why they go blank for a second, then "...because Git and $EDITOR complain about it"
@hisham_hm Actually because it can be the source of line changes that are unimportant. Adding or removing whitespace is irrelevant but will show up as a changed line in git. Therefore, removing whitespace early and sticking to keeping it removed keeps linechanges clean too.
@Gargron Whitespace-only diffs are a different/larger issue from trailing-whitespace.
I don't trim trailing whitespace and I still pay attention to avoid unimportant whitespace-only diffs.
Whitespace diffs can happen whether you trim trailing blanks or not (e.g. when people "align" C-style variable declarations then have to change/add one of them).
@hisham_hm I don't like trailing whitespace because it's completely invisible cruft. Sure, it harms nobody, but it's there, and because it's not surrounded on either side, there is no way to tell without selecting it. I have held an exception for indented blank lines, but that's changing because of the editors.
@impiaaa I love using indented blank lines, it's my #1 use-case for trailing whitespace (their presence has even been occasionally useful to me when scripting some edits over codebases).
Indeed, editors are getting more and more opinionated, clearly changing people's code writing habits. I'm not sure if that's always a good thing.
@hisham_hm One reason I actually like Eclipse is that is has a huge number of options for code formatting, whereas other IDEs I've used are more limited.
On the other hand, I don't have any strong preferences about code style, so I'm happy to stick with anything as long as it's consistent (which a code formatter will be).
@hisham_hm it messes up editor commands that operate on the end the line and you don't know it's there until the cursor goes to the wrong place, and once it's there it can't be removed without cluttering up the log
your history seems off too, for starters whitespace isn't lost when emailing diffs, and other projects disallowed trailing whitespace long before git happened, eg. freebsd added it to their style(9) in 1997 and it would have been an informal guideline long before it got added