From fb51184791246022e6d81e0bb97831a0f4ec3516 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 19 Feb 2013 15:08:17 +0100 Subject: [PATCH 1/2] Fix clean_comments() The detection of the comments pattern was using the last match of the regular expression. That is better to use the first one. --- scripts/licensecheck.pl | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl index 8d31626..ba9a2f2 100755 --- a/scripts/licensecheck.pl +++ b/scripts/licensecheck.pl @@ -353,16 +353,17 @@ sub parse_copyright { sub clean_comments { local $_ = shift or return q{}; + my $first_match; # Remove generic comments: look for 4 or more lines beginning with # regular comment pattern and trim it. Fall back to old algorithm # if no such pattern found. - if( 4 <= scalar(()=m{ ^\s* + if( 4 <= scalar(($first_match)=m{ ^\s* ([^a-zA-Z0-9\s]{1,3}) \s\w }xmg) ){ - my $comment_length=length($1); + my $comment_length=length($first_match); my $comment_re=qr{\s* [$1]{${comment_length}} \s*}x; s/^$comment_re//mg; } -- 1.7.7.6