Hi,
This patch adds a test to the coding standards which checks for space
or tab characters after a curly brace when the curly is the last
printable character on the line. The pumpking hasn't explicitly
declared that this should be a coding standard, but particle mentioned
that it was a pet peeve, and I thought I might as well write a test
:-)
Regards,
Paul
> This patch adds a test to the coding standards which checks for space
> or tab characters after a curly brace when the curly is the last
> printable character on the line. The pumpking hasn't explicitly
> declared that this should be a coding standard, but particle mentioned
> that it was a pet peeve, and I thought I might as well write a test
Is there any reason not to generalize this to report *any* whitespace
character at the end of a line before the newline?
-- c
That was exactly my thought when I read Paul's message Death to
trailing whitespace!
--
Mark J. Reed <mark...@mail.com>
set list
set listchars=trail:-,tab:\.\
note in this case, the trailing space on the second line is intentional.
~jerry
s/useless//
Me too, but there are still some test files with ws at the end, e.g.
t/op/sprintf_tests
You can stare at test result compares in vain, until you use od or such, to
actually get the reason for a failing test.
> ~jerry
leo
Note that ":set list" all by itself will reveal tabs and trailing
space with the default settings; the custom listchars are optional.
(Although if you ever do want hard tabs in your files, setting the
tab: listchars setting is is advised, since otherwise the tabs
collapse to ^I. With a custom value for tab:, the width of the
tabstop is maintained in the display.)
In this case, however, hard tabs seem to be taboo according to the
coding standards. (And the crowd goes wild!) So another good thing to
set in vim is 'expandtab', which automatically replaces tabs you type
with however many spaces are needed to get to the next tabstop (whose
spacing you can control with the appropriately-named 'tabstop'
option).
Once expandtab is on, you can issue a ":retab" command to replace any
existing hard tabs with spaces.
also, it should apply to perl files, as well. in fact, it should
probably apply to most files in MANIFEST and MANIFEST.skip, except for a
few where the spaces are required (like some test data files.) however,
i'd accept this patch if it were extended only to cover the perl files.
thanks for your hard work!
~jerry
> On Tue Oct 17 07:33:02 2006, paultc...@gmail.com wrote:
>> Well, the verdict defnitely seems to be that trailing space and tab
>> characters are annoyances that should go away :-) This patch adds a
>> new test (in place of the curly-space test I posted earlier) which
>> searches for superfluous trailing spaces in source files.
>>
>> Comments definitely welcome!
>>
> this is too noisy as ~700 tests. please convert it to one test,
> like the
> other coding standard tests.
>
t/codingstd/perlcritic.pl at least, has a test per file.
> also, it should apply to perl files, as well. in fact, it should
> probably apply to most files in MANIFEST and MANIFEST.skip, except
> for a
> few where the spaces are required (like some test data files.)
> however,
> i'd accept this patch if it were extended only to cover the perl
> files.
This is covered by perlcritic already, and if not, should be. I'm
happy to keep this targeted at the c-only files.
These tests already take too long to run, no need to test everything 2x.
> thanks for your hard work!
> ~jerry
>
--
Will "Coke" Coleda
wi...@coleda.com