perlcritic: Don't conditionally declare variables

This commit is contained in:
Graham Christensen 2021-09-07 21:35:01 -04:00
parent 21e1ff0da1
commit c603ae35f0
3 changed files with 8 additions and 4 deletions

View file

@ -306,7 +306,8 @@ sub getEvals {
{ order_by => "id DESC", rows => 1 }); { order_by => "id DESC", rows => 1 });
my $curInfo = getEvalInfo($cache, $curEval); 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. # Compute what inputs changed between each eval.
my @changedInputs; my @changedInputs;

View file

@ -82,7 +82,8 @@ sub buildFinished {
my $versionRE = "(?:[A-Za-z0-9\.\-]+)"; my $versionRE = "(?:[A-Za-z0-9\.\-]+)";
my $shortName = basename($covTarball); 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)" die "CoverityScan.pm: Couldn't parse build version for upload! ($shortName)"
unless defined $version; unless defined $version;

View file

@ -122,7 +122,8 @@ sub fetchInputBuild {
my $versionRE = "(?:[A-Za-z0-9\.\-]+)"; my $versionRE = "(?:[A-Za-z0-9\.\-]+)";
my $relName = ($prevBuild->releasename or $prevBuild->nixname); 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); my $mainOutput = getMainOutput($prevBuild);
@ -167,7 +168,8 @@ sub fetchInputSystemBuild {
my $versionRE = "(?:[A-Za-z0-9\.\-]+)"; my $versionRE = "(?:[A-Za-z0-9\.\-]+)";
my $relName = ($prevBuild->releasename or $prevBuild->nixname); my $relName = ($prevBuild->releasename or $prevBuild->nixname);
my $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/; my $version;
$version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/;
my $input = my $input =
{ storePath => getMainOutput($prevBuild)->path { storePath => getMainOutput($prevBuild)->path