[Geany-devel] Remove extra whitespace at end of lines in all source files?

Nick Treleaven nick.treleaven at xxxxx
Thu Oct 13 11:42:06 UTC 2011


On 12/10/2011 23:50, Matthew Brush wrote:
> On 11-10-12 07:14 AM, Nick Treleaven wrote:
>> On 12/10/2011 06:00, Matthew Brush wrote:
>>> Remove extra whitespace at end of lines in all source files.
>>>
>>> * Processed with rstrip-whitespace.py script added to scripts/
>>> directory.
>>> * Script run on all .c and .h files in src/ and plugins/ directories.
>>> * Also remove more than one newline at the end of files.
>>
>> We've mostly done this before, but I'm not sure this is a good idea. It
>> means more maintenance burden on receiving code. What's so bad about
>> trailing whitespace?
>
> The main reasons are to avoid noise in patches, prevent patch corruption

Unfortunately it can cause noise also.

> when sent over email, and IMO it's just good practice (ie. what people
> contributing code would expect). If we don't care about this, then why
> care about spaces vs. tabs, spaces before function parameter braces,
> indentation, and so on?

Those things affect readability.

> Also, I'm not suggesting that we reject code solely because of trailing
> whitespace, just that it become something the developers do; I would
> guess that the vast majority of what I removed in that commit was caused
> by Geany developers themselves.
>
> It takes two seconds to turn the stripping feature on in Geany or Git

How do I turn it on for Git?

The stripping feature in Geany should be made a project preference, I 
don't want to cause noise on non-Geany files.

> and it automatically handles the "bug" in Geany's auto-indent where it
> adds the indentation when you press enter but doesn't remove it when you
> leave the line blank. This is where the bulk of the trailing whitespace
> came from. As of for the extra newlines at the end of files, I think
> those are caused by a "bug" in one of the processing scripts used on
> Geany's source code (fix-alignment.pl:91 maybe).

The extra newlines were probably added by my function snippet that 
includes 2 trailing newlines.

> If you really feel strongly against this, I honestly don't mind if you
> revert the commit and we can just forget about it altogeher. FWIW, I did
> check with Colomban about this, confirming that there shouldn't be
> trailing whitespace and that it was ok to commit this, before doing so.
>
> Sorry for such a long response to something so trivial :)

I just thought I'd raise it. If we have Git support for this then it's 
not much of an issue.



More information about the Devel mailing list