perlcritic: explicitly assign the result of readdir/file reads

This commit is contained in:
Graham Christensen 2021-09-07 21:53:07 -04:00
parent 85bb1c7ef9
commit 741590c923
4 changed files with 10 additions and 10 deletions

View file

@ -343,11 +343,11 @@ sub getMachines {
for my $machinesFile (@machinesFiles) { for my $machinesFile (@machinesFiles) {
next unless -e $machinesFile; next unless -e $machinesFile;
open my $conf, "<$machinesFile" or die; open my $conf, "<$machinesFile" or die;
while (<$conf>) { while (my $line = <$conf>) {
chomp; chomp;
s/\#.*$//g; s/\#.*$//g;
next if /^\s*$/; next if /^\s*$/;
my @tokens = split /\s/, $_; my @tokens = split /\s/, $line;
my @supportedFeatures = split(/,/, $tokens[5] || ""); my @supportedFeatures = split(/,/, $tokens[5] || "");
my @mandatoryFeatures = split(/,/, $tokens[6] || ""); my @mandatoryFeatures = split(/,/, $tokens[6] || "");
$machines{$tokens[0]} = $machines{$tokens[0]} =

View file

@ -53,9 +53,9 @@ sub buildFinished {
my $covTarball; my $covTarball;
opendir my $tarballs_handle, $tarballs or die; opendir my $tarballs_handle, $tarballs or die;
while (readdir $tarballshandle) { while (my $file = readdir $tarballshandle) {
next unless $_ =~ /.*-coverity-int\.(tgz|lzma|xz|bz2|zip)$/; next unless $file =~ /.*-coverity-int\.(tgz|lzma|xz|bz2|zip)$/;
$covTarball = "$tarballs/$_"; last; $covTarball = "$tarballs/$file"; last;
} }
closedir $tarballs_handle; closedir $tarballs_handle;

View file

@ -102,8 +102,8 @@ sub buildFinished {
open( $authfile, "<", $sotest->{authfile} ) open( $authfile, "<", $sotest->{authfile} )
or die "Cannot open Sotest authfile \${\$sotest->{authfile}}"; or die "Cannot open Sotest authfile \${\$sotest->{authfile}}";
while (<$authfile>) { while (my $line = <$authfile>) {
if ( $_ =~ /(.+):(.+)/m ) { if ( $line =~ /(.+):(.+)/m ) {
$sotest_username = $1; $sotest_username = $1;
$sotest_password = $2; $sotest_password = $2;
} }

View file

@ -40,9 +40,9 @@ ok(-e "/tmp/s3/hydra/$successful_hash.narinfo", "The narinfo of a build that's a
my $gcRootsDir = getGCRootsDir; my $gcRootsDir = getGCRootsDir;
opendir my $dir, $gcRootsDir or die; opendir my $dir, $gcRootsDir or die;
while(readdir $dir) { while(my $file = readdir $dir) {
next if $_ eq "." or $_ eq ".."; next if $file eq "." or $file eq "..";
unlink "$gcRootsDir/$_"; unlink "$gcRootsDir/$file";
} }
closedir $dir; closedir $dir;
system("hydra-s3-backup-collect-garbage"); system("hydra-s3-backup-collect-garbage");