[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: more patches



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:

> --- 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.

> +        my ($_quoted, $_words) = (quotemeta($1), $1);
> +        $wo_quotes =~ s/$_quoted//;

    $wo_quotes =~ s/\Q$words//;

is equivalent and doesn't require the extra variable.  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.

Thank you for the test suite entries!

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: