Perl development styleguide
Mark Martinec
Mark.Martinec at ijs.si
Thu Nov 1 21:42:54 CET 2018
>>> If you want to retain your mind, don't run [perlcritic] on the Amavis
>>> code.
Amavisd underwent perl critic with every release.
There are (rare) cases where a certain rule is intentionally
broken, and such cases documented by a comment/explanation there.
An example of such would be ignoring a potential double error in
the error handling code (like a 'print' to stderr failing there).
On the other hand there are several 'advices' issued by a
perl critic, which are harmful and are intentionally avoided.
An example of such would be that a 'return undef' is to be
replaced by a 'return' with no argument. Although this can have
valid uses, I found that blindly following it can easily introduce
a nasty bug. Following this advice makes such function unusable
in a list context (like in computing an argument of another call).
In effect arguments (list elements) end up shifted by one, which
has caused bugs in the past.
Here is my amavisd-perl-critic.profile profile file
that has been in use (the 'exclude' list should be a single
line, probably will end up wrapped in this mail):
# severity = 5
# verbose = 9
# verbose = %m at %f line %L\n
verbose = [%p] %f line %L, %m, near '%r' (Sev.%s)\n
exclude = ValuesAndExpressions::ProhibitLeadingZeros
Subroutines::ProhibitSubroutinePrototypes
Subroutines::RequireFinalReturn BuiltinFunctions::RequireBlockMap
BuiltinFunctions::RequireBlockGrep
ValuesAndExpressions::ProhibitMixedBooleanOperators
Subroutines::RequireArgUnpacking
Variables::RequireLocalizedPunctuationVars
Modules::ProhibitAutomaticExportation
ValuesAndExpressions::ProhibitCommaSeparatedStatements
Subroutines::ProhibitBuiltinHomonyms
TestingAndDebugging::RequireUseWarnings
BuiltinFunctions::ProhibitStringyEval
ValuesAndExpressions::ProhibitConstantPragma
ControlStructures::ProhibitUnreachableCode
Variables::ProhibitPackageVars
RegularExpressions::RequireExtendedFormatting
Modules::ProhibitExcessMainComplexity
BuiltinFunctions::ProhibitComplexMappings
Variables::RequireInitializationForLocalVars
ErrorHandling::RequireCarping Subroutines::ProhibitExcessComplexity
RegularExpressions::ProhibitComplexRegexes Subroutines::ProhibitManyArgs
ControlStructures::ProhibitDeepNests
ControlStructures::ProhibitCascadingIfElse
BuiltinFunctions::ProhibitLvalueSubstr
BuiltinFunctions::ProhibitUniversalIsa
ClassHierarchies::ProhibitExplicitISA
RegularExpressions::ProhibitCaptureWithoutTest
# Variables::ProhibitReusedNames
[TestingAndDebugging::ProhibitNoStrict]
allow = refs subs
[TestingAndDebugging::ProhibitNoWarnings]
allow = uninitialized once qw
More information about the amavis-devel
mailing list