perlcritic: each() called at line 752, column 35. The each function may cause undefined behavior when operating on the hash while iterating. Use a foreach loop over the hash's keys or values instead.
This commit is contained in:
parent
7dcf6a01c6
commit
4dfe787bc2
|
@ -64,7 +64,8 @@ sub updateDeclarativeJobset {
|
||||||
$db->txn_do(sub {
|
$db->txn_do(sub {
|
||||||
my $jobset = $project->jobsets->update_or_create(\%update);
|
my $jobset = $project->jobsets->update_or_create(\%update);
|
||||||
$jobset->jobsetinputs->delete;
|
$jobset->jobsetinputs->delete;
|
||||||
while ((my $name, my $data) = each %{$declSpec->{"inputs"}}) {
|
foreach my $name (keys %{$declSpec->{"inputs"}}) {
|
||||||
|
my $data = $declSpec->{"inputs"}{$name};
|
||||||
my $row = {
|
my $row = {
|
||||||
name => $name,
|
name => $name,
|
||||||
type => $data->{type}
|
type => $data->{type}
|
||||||
|
@ -84,7 +85,8 @@ sub handleDeclarativeJobsetJson {
|
||||||
my @kept = keys %$declSpec;
|
my @kept = keys %$declSpec;
|
||||||
push @kept, ".jobsets";
|
push @kept, ".jobsets";
|
||||||
$project->jobsets->search({ name => { "not in" => \@kept } })->update({ enabled => 0, hidden => 1 });
|
$project->jobsets->search({ name => { "not in" => \@kept } })->update({ enabled => 0, hidden => 1 });
|
||||||
while ((my $jobsetName, my $spec) = each %$declSpec) {
|
foreach my $jobsetName (keys %$declSpec) {
|
||||||
|
my $spec = $declSpec{$jobsetName};
|
||||||
eval {
|
eval {
|
||||||
updateDeclarativeJobset($db, $project, $jobsetName, $spec);
|
updateDeclarativeJobset($db, $project, $jobsetName, $spec);
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -118,7 +118,8 @@ sub fetchInput {
|
||||||
$jobset->get_column('name'),
|
$jobset->get_column('name'),
|
||||||
$name);
|
$name);
|
||||||
# give preference to the options from the input value
|
# give preference to the options from the input value
|
||||||
while (my ($opt_name, $opt_value) = each %{$options}) {
|
foreach my $opt_name (keys %{$options}) {
|
||||||
|
my $opt_value = $options{$opt_name};
|
||||||
if ($opt_value =~ /^[+-]?\d+\z/) {
|
if ($opt_value =~ /^[+-]?\d+\z/) {
|
||||||
$opt_value = int($opt_value);
|
$opt_value = int($opt_value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,8 @@ sub buildFinished {
|
||||||
foreach my $reference (@{$refs}) {
|
foreach my $reference (@{$refs}) {
|
||||||
push @needed_paths, $reference;
|
push @needed_paths, $reference;
|
||||||
}
|
}
|
||||||
while (my ($compression_type, $configs) = each %compression_types) {
|
foreach my $compression_type (keys %compression_types) {
|
||||||
|
my $configs = $compression_types{$compression_type};
|
||||||
my @incomplete_buckets = ();
|
my @incomplete_buckets = ();
|
||||||
# Don't do any work if all the buckets have this path
|
# Don't do any work if all the buckets have this path
|
||||||
foreach my $bucket_config (@{$configs}) {
|
foreach my $bucket_config (@{$configs}) {
|
||||||
|
@ -144,7 +145,8 @@ sub buildFinished {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Upload narinfos
|
# Upload narinfos
|
||||||
while (my ($compression_type, $infos) = each %narinfos) {
|
foreach my $compression_type (keys %narinfos) {
|
||||||
|
my $infos = $narinfos{$compression_type};
|
||||||
foreach my $bucket_config (@{$compression_types{$compression_type}}) {
|
foreach my $bucket_config (@{$compression_types{$compression_type}}) {
|
||||||
foreach my $info (@{$infos}) {
|
foreach my $info (@{$infos}) {
|
||||||
my $bucket = $client->bucket( name => $bucket_config->{name} );
|
my $bucket = $client->bucket( name => $bucket_config->{name} );
|
||||||
|
|
|
@ -753,7 +753,8 @@ sub checkJobsetWrapped {
|
||||||
|
|
||||||
if ($jobsetChanged) {
|
if ($jobsetChanged) {
|
||||||
# Create JobsetEvalMembers mappings.
|
# Create JobsetEvalMembers mappings.
|
||||||
while (my ($id, $x) = each %buildMap) {
|
foreach my $id (keys %buildMap) {
|
||||||
|
my $x = $buildMap{$id};
|
||||||
$ev->jobsetevalmembers->create({ build => $id, isnew => $x->{new} });
|
$ev->jobsetevalmembers->create({ build => $id, isnew => $x->{new} });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -762,7 +763,8 @@ sub checkJobsetWrapped {
|
||||||
# builds for the same derivation, pick the one with the
|
# builds for the same derivation, pick the one with the
|
||||||
# shortest name.
|
# shortest name.
|
||||||
my %drvPathToId;
|
my %drvPathToId;
|
||||||
while (my ($id, $x) = each %buildMap) {
|
foreach my $id (keys %buildMap) {
|
||||||
|
my $x = $buildMap{$id};
|
||||||
my $y = $drvPathToId{$x->{drvPath}};
|
my $y = $drvPathToId{$x->{drvPath}};
|
||||||
if (defined $y) {
|
if (defined $y) {
|
||||||
next if length $x->{jobName} > length $y->{jobName};
|
next if length $x->{jobName} > length $y->{jobName};
|
||||||
|
@ -806,7 +808,8 @@ sub checkJobsetWrapped {
|
||||||
|
|
||||||
# Wake up hydra-queue-runner.
|
# Wake up hydra-queue-runner.
|
||||||
my $lowestId;
|
my $lowestId;
|
||||||
while (my ($id, $x) = each %buildMap) {
|
foreach my $id (keys %buildMap) {
|
||||||
|
my $x = $buildMap{$id};
|
||||||
$lowestId = $id if $x->{new} && (!defined $lowestId || $id < $lowestId);
|
$lowestId = $id if $x->{new} && (!defined $lowestId || $id < $lowestId);
|
||||||
}
|
}
|
||||||
$notifyAdded->execute($lowestId) if defined $lowestId;
|
$notifyAdded->execute($lowestId) if defined $lowestId;
|
||||||
|
|
Loading…
Reference in a new issue