Why is it bad to check in lines with trailing whitespace to your source control? What kinds of problems could that cause?
views:
370answers:
6False differences, basically. It's helpful if diffs only show "real" changes. Some diff programs will ignore whitespace, but it would be better just to avoid the dummy change in the first place.
Of course, it also doesn't help if it makes the line wrap on a colleague's machine.
Because many people remove them you will have them show up as modified lines in diff tools if you don't use all the options (say a plain old cvs diff) which means people see your line for no good reason.
In theory you could also have strings that wrap lines where whitespace would truly be bad, but... probably not your issue.
Yeah, I sort of agree with the other posts, but I would add that it's not bad per se. It is not a great practice, but that's the sort of thing that happens and you just sort of sigh and get on with things.
It's like painting your walls, but not finishing the edges off properly, and going right onto the skirting board.
Some editors automatically remove trailing whitespace, some don't. This creates diff noise and can cause merge conflicts.