1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
pgbackrest/test/lint/perlcritic.policy
David Steele d4c46acf48 Working on #174: Get Perl Critic to pass on stern
Added single exception for the violation of BuiltinFunctions::ProhibitStringyEval and removed from policy file.
2016-02-23 09:39:37 -05:00

202 lines
7.8 KiB
Plaintext

# Main Perl Critic Policy Applied to Entire Code Base
#-----------------------------------------------------------------------------------------------------------------------------------
# Important policies that should always be checked
#-----------------------------------------------------------------------------------------------------------------------------------
[TestingAndDebugging::RequireUseStrict]
severity = 5
[TestingAndDebugging::RequireUseWarnings]
severity = 5
# Permanent Exceptions
#-----------------------------------------------------------------------------------------------------------------------------------
# Requires all local variables to be all lower/upper case -- can't see how this is a good thing.
[-NamingConventions::Capitalization]
# Requires @_ to be immediately unpacked but won't work with param logging scheme.
[-Subroutines::RequireArgUnpacking]
# Requires all exports to be configurable by caller. This is fine for independent libraries but
# overly burdensome for modules integrated as part of an application. Maybe apply to certain modules
# that are also used by doc and test programs?
[-Modules::ProhibitAutomaticExportation]
# Requires built-in functions to not have parens, but in this project it is preferred to wrap all
# function calls in parens for consistency.
[-CodeLayout::ProhibitParensWithBuiltins]
# Requires module version vars. Probably not practical for built-in modules.
[-Modules::RequireVersionVar]
# Requires extended formatting for all regexps. Seems overly burdensome, or at least something to look
# at a lot further down the road.
[-RegularExpressions::RequireExtendedFormatting]
# Requires Unicode safe expressions. May be worth looking at sometime.
[-RegularExpressions::ProhibitEnumeratedClasses]
# S2 - Requires List::MoreUtils instead of boolean grep. Not worth it to load another module.
[-BuiltinFunctions::ProhibitBooleanGrep]
# Provisional Exceptions for Test & Documentation Code
#-----------------------------------------------------------------------------------------------------------------------------------
# S2 - Requires complete POD sections but these are being removed anyway in favor of Config.pm.
[-Documentation::RequirePodSections]
[-Documentation::RequirePodAtEnd]
# S3 - Requires regexps to be below a certain length. Seems burdensome.
[-RegularExpressions::ProhibitComplexRegexes]
# To Be Fixed or Evaluated
#
# Natural ordering here indicates the order in which they should be addressed.
#-----------------------------------------------------------------------------------------------------------------------------------
# S4 - Requires array offset from end to use negative syntax.
[-Variables::RequireNegativeIndices]
# S3 - Requires all variables to be used.
[-Variables::ProhibitUnusedVariables]
# S2 - Requires all long numbers to have thousand separators.
[-ValuesAndExpressions::RequireNumberSeparators]
# S4 - Requires simple assignments in declarations. (TEST ONLY)
[-Variables::ProhibitAugmentedAssignmentInDeclaration]
# S3 - Requires safe checking of evals.
[-ErrorHandling::RequireCheckingReturnValueOfEval]
# S4 - Requires parans when logical and bitwise booleans are mixed.
[-ValuesAndExpressions::ProhibitMixedBooleanOperators]
# S4 - Requires that sub names not overlap with built-ins - a bummer for object members.
[-Subroutines::ProhibitBuiltinHomonyms]
# S4 - Requires block form of grep for readability.
[-BuiltinFunctions::RequireBlockGrep]
# S4 - Requires modification of certain vars (e.g. $SIG) to have local scope.
[-Variables::RequireLocalizedPunctuationVars]
# S4 - Requires close() to be called soon after open but seems arbitrary.
[-InputOutput::RequireBriefOpen]
# S1 - Requires reverse keyword for reverse sorts instead of block.
[-BuiltinFunctions::ProhibitReverseSortBlock]
# S3 - Requires use of Carp instead of die or warn.
[-ErrorHandling::RequireCarping]
# S3 - Requires use of local vars in packages.
[-Variables::ProhibitPackageVars]
# S3 - Require conditional use statements to use dynamic load logic
[-Modules::ProhibitConditionalUseStatements]
# S3 - Requires that certain operators not be mixed.
[-ValuesAndExpressions::ProhibitMismatchedOperators]
# S2 - Requires use of if instead of unless.
[-ControlStructures::ProhibitUnlessBlocks]
# S1 - Requires true literals to use single quotes.
[-ValuesAndExpressions::ProhibitInterpolationOfLiterals]
# S2 - Requires split expressions to be regexp for clarity.
[-BuiltinFunctions::ProhibitStringySplit]
# S4 - Requires use of Readonly instead of const. Has performance and syntax advantages.
[-ValuesAndExpressions::ProhibitConstantPragma]
# S2 - Requires all numbers to be defined as constants
[-ValuesAndExpressions::ProhibitMagicNumbers]
# S4 - Requires all subs to have a return, even if there is not value to return.
[-Subroutines::RequireFinalReturn]
# S4 - Requires new to be called as Object->new().
[-Objects::ProhibitIndirectSyntax]
# S2 - Requires that & not be used in functions calls. Currently this is used a lot for &log() calls.
[-Subroutines::ProhibitAmpersandSigils]
# S2 - Requires use of eq instead of regexp when possible.
[-RegularExpressions::ProhibitFixedStringMatches]
# S2 - Requires that sigils be separated by braces, eg %$var becomes %{$var}.
[-References::ProhibitDoubleSigils]
# S2 - Requires use English instead a puctuation vars such as $!.
[-Variables::ProhibitPunctuationVars]
# S3 - Requires nested if/else have limited depth and recommends using given/when instead.
[-ControlStructures::ProhibitCascadingIfElse]
# S2 - Requires empty strings to be represented with qw{}.
[-ValuesAndExpressions::ProhibitEmptyQuotes]
# S2 - Requires non letter and number strings to be represented with something like qw{/}.
[-ValuesAndExpressions::ProhibitNoisyQuotes]
# S2 - Requires expanded matching for . in regular expressions.
[-RegularExpressions::RequireDotMatchAnything]
# S2 - Requires sed-style boundary matching. May not be appropriate for reg exps in this project, though.
[-RegularExpressions::RequireLineBoundaryMatching]
# S1 - Requires use of Perl::Tidy.
[-CodeLayout::RequireTidyCode]
# S2 - Requires use of Perl syntax for simple loops, e.g. for (0..$max).
[-ControlStructures::ProhibitCStyleForLoops]
# S2 - Require standard if structures rather than postfix for readability.
[-ControlStructures::ProhibitPostfixControls]
# S3 - Requires code have a McCabe score of no more than 20 but is configurable.
[-Subroutines::ProhibitExcessComplexity]
[-Modules::ProhibitExcessMainComplexity]
# S3 - Requires low level of code nesting (may require a lot of refactoring).
[-ControlStructures::ProhibitDeepNests]
# S3 - Requires subs to have <= 6 args but is configurable.
[-Subroutines::ProhibitManyArgs]
# S3 - Requires arbitrary unambigious names but is configurable.
[-NamingConventions::ProhibitAmbiguousNames]
# S3 - Requires that var names never be resused in a sub, not sure about this one.
[-Variables::ProhibitReusedNames]
# S3 - Requires non-capturing groups in regexp, primarily a performance optimization.
[-RegularExpressions::ProhibitUnusedCapture]
# S1 - Requires trailing commas on all lists.
[-CodeLayout::RequireTrailingCommas]
# S2 - Requires chained calls be less than four.
[-ValuesAndExpressions::ProhibitLongChainsOfMethodCalls]
# S2 - Requires check for success of close() function.
[-InputOutput::RequireCheckedClose]
# S1 - Requires use Fatal or autodie with syscalls.
[-InputOutput::RequireCheckedSyscalls]
# S1 - Requires less abiguity for metacharacters in strings.
[-ValuesAndExpressions::RequireInterpolationOfMetachars]
# S4 - Requires character classes to reduce escapes in regexps.
[-RegularExpressions::ProhibitEscapedMetacharacters]
# S1 - Require character classes rather than single character alternation.
[-RegularExpressions::ProhibitSingleCharAlternation]
# S2 - Require qw{} syntax for quoted string lists
[-CodeLayout::ProhibitQuotedWordLists]