Re: more patches
Russ Allbery wrote:
> Raphael Geissert <atomo64+debian@gmail.com>
> writes:
>
>> lintian_improved....patch:
>>
>> I made a couple of changes so it matches "bla bla bla" at the same time,
>> and to make it catch all of the duplicated lines on the same line.
>
> Applied with a few fixes:
Thanks! :)
>
>> --- a/checks/description
>> +++ b/checks/description
>> @@ -117,9 +117,12 @@ while (<IN>) {
>> }
>>
>> my $wo_quotes = $_;
>> - $wo_quotes =~ s,(\"|\').*(\1),,;
>> - if ($wo_quotes =~ m,((?:\W|^)(\w+)\s+(\2)(?:\W|$)),i) {
>> - tag "description-contains-duplicated-word", "$1";
>> + $wo_quotes =~ s,(\"|\')(.*?)(\1),,;
>> + while ($wo_quotes =~ m,((?:\W|^)(\w+)(\s+(\2))+(?:\W|$)),i) {
>
> I'd fixed the previous version to not put the trailing (?:\W|$) inside the
> capturing parens, which also means you don't have to trim whitespace from
> it afterwards.
Ok
>
>> + my ($_quoted, $_words) = (quotemeta($1), $1);
>> + $wo_quotes =~ s/$_quoted//;
>
> $wo_quotes =~ s/\Q$words//;
>
> is equivalent and doesn't require the extra variable.
I didn't know that (I'm not a perl expert, though; actually, I'm still
learning some basic stuff).
> Also, Lintian
> doesn't usually use a leading underscore in the names of local variables;
> no need, the my namespace will keep them local to that block.
I use underscores to let _me_ know that it is a local var so I don't have to
check where it was defined. But if lintian doesn't use them, it's fine :)
>
> Thank you for the test suite entries!
>
:)
Cheers,
--
Atomo64 - Raphael
Please avoid sending me Word, PowerPoint or Excel attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
Reply to: