1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-02 12:41:14 +03:00

Silence some perl critic warnings.

* Variables::RequireNegativeIndice
* Variables::ProhibitUnusedVariables
* Variables::ProhibitAugmentedAssignmentInDeclaration
* Modules::ProhibitConditionalUseStatements
This commit is contained in:
Cynthia Shang
2017-04-10 17:23:39 -04:00
committed by David Steele
parent 8546571461
commit 21a000d002
10 changed files with 21 additions and 29 deletions

View File

@@ -318,7 +318,7 @@ sub execute
} }
else else
{ {
$strOutput .= (defined($strOutput) ? "\n" : '') . $stryOutput[@stryOutput - 1]; $strOutput .= (defined($strOutput) ? "\n" : '') . $stryOutput[-1];
} }
} }
} }

View File

@@ -644,7 +644,7 @@ sub processTag
if (!defined($strTag)) if (!defined($strTag))
{ {
use Data::Dumper; require Data::Dumper;
confess Dumper($oTag); confess Dumper($oTag);
} }

View File

@@ -275,7 +275,6 @@ sub sectionProcess
my $oSectionBodyElement = $oSectionElement->addNew(HTML_DIV, "section-body"); my $oSectionBodyElement = $oSectionElement->addNew(HTML_DIV, "section-body");
# Process each child # Process each child
my $oSectionBodyExe;
my $iSectionNo = 1; my $iSectionNo = 1;
foreach my $oChild ($oSection->nodeList()) foreach my $oChild ($oSection->nodeList())

View File

@@ -203,6 +203,14 @@
<release-item> <release-item>
<p>Refactor <code>backupLabel()</code> and add unit tests.</p> <p>Refactor <code>backupLabel()</code> and add unit tests.</p>
</release-item> </release-item>
<release-item>
<release-item-contributor-list>
<release-item-contributor id="shang.cynthia"/>
</release-item-contributor-list>
<p>Silence some perl critic warnings.</p>
</release-item>
</release-refactor-list> </release-refactor-list>
</release-core-list> </release-core-list>

View File

@@ -355,7 +355,7 @@ sub logDebugProcess
$$oParamHash{$strParamName}{default} = true; $$oParamHash{$strParamName}{default} = true;
} }
$oValue = $oyResult[@oyResult - 1]; $oValue = $oyResult[-1];
if (!defined($oValue) && $bParamRequired) if (!defined($oValue) && $bParamRequired)
{ {

View File

@@ -1245,7 +1245,6 @@ sub copy
if ($bSourceRemote || $bDestinationRemote) if ($bSourceRemote || $bDestinationRemote)
{ {
# Build the command and open the local file # Build the command and open the local file
my $hFile;
my $hIn, my $hIn,
my $hOut; my $hOut;
my $strRemote; my $strRemote;
@@ -1312,8 +1311,6 @@ sub copy
if ($bController) if ($bController)
{ {
# Test for an error when reading output # Test for an error when reading output
my $strOutput;
eval eval
{ {
($bResult, my $strResultChecksum, my $iResultFileSize, my $rResultExtra) = ($bResult, my $strResultChecksum, my $iResultFileSize, my $rResultExtra) =

View File

@@ -264,7 +264,7 @@ sub formatTextBackup
{name => 'oBackupInfo', trace => true}, {name => 'oBackupInfo', trace => true},
); );
my $strOutput .= my $strOutput =
' ' . $$oBackupInfo{&INFO_KEY_TYPE} . ' backup: ' . $$oBackupInfo{&INFO_KEY_LABEL} . "\n" . ' ' . $$oBackupInfo{&INFO_KEY_TYPE} . ' backup: ' . $$oBackupInfo{&INFO_KEY_LABEL} . "\n" .
' timestamp start/stop: ' . ' timestamp start/stop: ' .

View File

@@ -151,7 +151,7 @@ sub supplementalAdd
open(my $hFile, '<', $strFileName) open(my $hFile, '<', $strFileName)
or confess &log(ERROR, "unable to open ${strFileName} for appending to test log"); or confess &log(ERROR, "unable to open ${strFileName} for appending to test log");
my $strHeader .= "+ supplemental file: " . $self->regExpReplaceAll($strFileName); my $strHeader = "+ supplemental file: " . $self->regExpReplaceAll($strFileName);
if (defined($strComment)) if (defined($strComment))
{ {

View File

@@ -256,7 +256,7 @@ sub backupCreate
defined($oLastManifest) ? $oLastManifest->get(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LABEL) : undef, defined($oLastManifest) ? $oLastManifest->get(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LABEL) : undef,
$lTimestamp); $lTimestamp);
my $strBackupClusterSetPath .= "$$oStanza{strBackupClusterPath}/${strBackupLabel}"; my $strBackupClusterSetPath = "$$oStanza{strBackupClusterPath}/${strBackupLabel}";
filePathCreate($strBackupClusterSetPath); filePathCreate($strBackupClusterSetPath);
&log(INFO, "create backup ${strBackupLabel}"); &log(INFO, "create backup ${strBackupLabel}");

View File

@@ -55,45 +55,33 @@ severity = 5
# Natural ordering here indicates the order in which they should be addressed. # Natural ordering here indicates the order in which they should be addressed.
#----------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------
# S4 - Requires array offset from end to use negative syntax. # S2 - Requires all long numbers to have thousand separators. Probably a good idea bit need to change a fair amount of code.
[-Variables::RequireNegativeIndices]
# S3 - Requires all variables to be used.
[-Variables::ProhibitUnusedVariables]
# S2 - Requires all long numbers to have thousand separators.
[-ValuesAndExpressions::RequireNumberSeparators] [-ValuesAndExpressions::RequireNumberSeparators]
# S4 - Requires simple assignments in declarations. (TEST ONLY) # S4 - Requires parens when logical and bitwise booleans are mixed.
[-Variables::ProhibitAugmentedAssignmentInDeclaration]
# S4 - Requires parans when logical and bitwise booleans are mixed.
[-ValuesAndExpressions::ProhibitMixedBooleanOperators] [-ValuesAndExpressions::ProhibitMixedBooleanOperators]
# S4 - Requires that sub names not overlap with built-ins - a bummer for object members. # S4 - Requires that sub names not overlap with built-ins - a bummer for object members.
[-Subroutines::ProhibitBuiltinHomonyms] [-Subroutines::ProhibitBuiltinHomonyms]
# S4 - Requires block form of grep for readability. # S4 - Requires block form of grep for readability. Needs to be fixed in about 15 places.
[-BuiltinFunctions::RequireBlockGrep] [-BuiltinFunctions::RequireBlockGrep]
# S4 - Requires modification of certain vars (e.g. $SIG) to have local scope. # S4 - Requires modification of certain vars (e.g. $SIG) to have local scope. Needs to be fixed in about 20 places.
[-Variables::RequireLocalizedPunctuationVars] [-Variables::RequireLocalizedPunctuationVars]
# S4 - Requires close() to be called soon after open but seems arbitrary. # S4 - Requires close() to be called soon after open but seems arbitrary.
[-InputOutput::RequireBriefOpen] [-InputOutput::RequireBriefOpen]
# S1 - Requires reverse keyword for reverse sorts instead of block. # S1 - Requires reverse keyword for reverse sorts instead of block. May not be able to since $a $b are passed as a parameter.
[-BuiltinFunctions::ProhibitReverseSortBlock] [-BuiltinFunctions::ProhibitReverseSortBlock]
# S3 - Requires use of Carp instead of die or warn. # S3 - Requires use of Carp instead of die or warn. Doesn't seem useful.
[-ErrorHandling::RequireCarping] [-ErrorHandling::RequireCarping]
# S3 - Requires use of local vars in packages. # S3 - Requires use of local vars in packages. Can't use as it prohibits use of $DBI::errstr.
[-Variables::ProhibitPackageVars] [-Variables::ProhibitPackageVars]
# S3 - Require conditional use statements to use dynamic load logic
[-Modules::ProhibitConditionalUseStatements]
# S3 - Requires that certain operators not be mixed. # S3 - Requires that certain operators not be mixed.
[-ValuesAndExpressions::ProhibitMismatchedOperators] [-ValuesAndExpressions::ProhibitMismatchedOperators]