Re: [PATCH] Make test script annotate-tests.sh handle missing authors

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

 



Kevin Ballard <kevin@xxxxxx> writes:

> Also, I'm not a Perl programmer, so it's possible there's a better idiom
> for this sort of thing.
> 
>  t/annotate-tests.sh |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
> index 396b965..4e37a66 100644
> --- a/t/annotate-tests.sh
> +++ b/t/annotate-tests.sh
> @@ -9,6 +9,9 @@ check_count () {
>  	cat .result | perl -e '
>  		my %expect = (@ARGV);
>  		my %count = ();
> +		while (my ($author, $count) = each %expect) {
> +			$count{$author} = 0;
> +		}


First, it is a very bad practice to have variables of different type
named the same way, here %count (hash) and $count (scalar, unused).

Perl idiom way would be

  -		my %count = ();
  +		my %count = map { $_ => 0 } keys %expect;

>  		while (<STDIN>) {
>  			if (/^[0-9a-f]+\t\(([^\t]+)\t/) {
>  				my $author = $1;
> -- 
> 1.7.3.1.186.gc0af9.dirty
> 

-- 
Jakub Narebski
Poland
ShadeHawk on #git
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]