[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] maint: new syntax-check rule: prohibit empty lines at EOF
From: |
Jim Meyering |
Subject: |
Re: [PATCH] maint: new syntax-check rule: prohibit empty lines at EOF |
Date: |
Sat, 10 Apr 2010 19:13:20 +0200 |
Pádraig Brady wrote:
> On 10/04/10 13:53, Jim Meyering wrote:
>> Here's a rule I'm adding to coreutils' cfg.mk.
>> However, I would like to use it several other projects,
>> so rather than duplicating it in each, I'm thinking of
>> putting it in gnulib's maint.mk.
>>
>> Opinions?
>>
>> I know that at least Bruno likes to retain trailing empty
>> lines in modules/ files. But for a class of files like that,
>> it's easy to exempt "^modules/" or to omit the rule altogether.
>>
>> Does anyone object to my adding this syntax check to maint.mk?
>>
>> Aside from that, can anyone improve on the code?
>> The multi-line Perl script is the only way I could get
>> the efficiency I wanted, but there may well be another
>> more concise way.
>
> Maybe something like this?
> tail -n1 files... | sed -n 's/==> \(.*\) <==/\1/; t blanks;d; :blanks h;n;/^
> *$/{x;p};'
> Though that won't work on solaris for example.
Good idea to parse tail output.
This floats my boat:
tail -n1 ... | perl -00 -ne '/^==> ([^\n]+) <==\n\n/m and print "$1\n"'
Several of the syntax-check rules already rely on perl,
and since this would search only version-controlled files,
we should be safe in assuming no name includes a newline.