Re: [PATCH 1/4] test: Add target test-lint-shell-syntax

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

 



Jeff King <peff@xxxxxxxx> writes:

> So taking all of that, a more idiomatic perl script would look something
> like:
>
>   my $exit_code;
>   sub err {
>     my $msg = shift;
>     print "$ARGV:$.: error: $msg: $_\n";
>     $exit_code = 1;
>   }
>
>   while (<>) {
>     chomp;
>     if (/^\s*sed\s+-i/) {
>       err('sed -i is not portable');
>     }
>     # ...and so on
>
>     # this resets our $. for each file
>     close ARGV if eof;
>   }
>   exit $exit_code;
>
> I'd personally probably write the conditions like:
>
>   /^\s*sed\s+-i/ and err('sed -i is not portable');
>
> to make the structure of the program (i.e., a list of conditions to
> complain about) clear, but I know not everybody agrees with such a terse
> style.

Thanks for a nicely-done review.
--
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]