From c603ae35f010bad3e4ec83a61d718e28d935e637 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 7 Sep 2021 21:35:01 -0400 Subject: [PATCH] perlcritic: Don't conditionally declare variables --- src/lib/Hydra/Helper/Nix.pm | 3 ++- src/lib/Hydra/Plugin/CoverityScan.pm | 3 ++- src/script/hydra-eval-jobset | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index e1c56b06..063e053e 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -306,7 +306,8 @@ sub getEvals { { order_by => "id DESC", rows => 1 }); my $curInfo = getEvalInfo($cache, $curEval); - my $prevInfo = getEvalInfo($cache, $prevEval) if defined $prevEval; + my $prevInfo; + $prevInfo = getEvalInfo($cache, $prevEval) if defined $prevEval; # Compute what inputs changed between each eval. my @changedInputs; diff --git a/src/lib/Hydra/Plugin/CoverityScan.pm b/src/lib/Hydra/Plugin/CoverityScan.pm index fcedf92a..472b8e7e 100644 --- a/src/lib/Hydra/Plugin/CoverityScan.pm +++ b/src/lib/Hydra/Plugin/CoverityScan.pm @@ -82,7 +82,8 @@ sub buildFinished { my $versionRE = "(?:[A-Za-z0-9\.\-]+)"; my $shortName = basename($covTarball); - my $version = $2 if $shortName =~ /^($pkgNameRE)-($versionRE)-coverity-int.*$/; + my $version; + $version = $2 if $shortName =~ /^($pkgNameRE)-($versionRE)-coverity-int.*$/; die "CoverityScan.pm: Couldn't parse build version for upload! ($shortName)" unless defined $version; diff --git a/src/script/hydra-eval-jobset b/src/script/hydra-eval-jobset index cca2243d..4a165d86 100755 --- a/src/script/hydra-eval-jobset +++ b/src/script/hydra-eval-jobset @@ -122,7 +122,8 @@ sub fetchInputBuild { my $versionRE = "(?:[A-Za-z0-9\.\-]+)"; my $relName = ($prevBuild->releasename or $prevBuild->nixname); - my $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/; + my $version; + $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/; my $mainOutput = getMainOutput($prevBuild); @@ -167,7 +168,8 @@ sub fetchInputSystemBuild { my $versionRE = "(?:[A-Za-z0-9\.\-]+)"; my $relName = ($prevBuild->releasename or $prevBuild->nixname); - my $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/; + my $version; + $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/; my $input = { storePath => getMainOutput($prevBuild)->path