1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
|
verbose = %f:%l:%c:%p:%m\n
color = 1
program-extensions = .PL .pl .t
only = 1
severity = 2
# Use `List::MoreUtils::any' instead of `grep' in boolean context.
[BuiltinFunctions::ProhibitBooleanGrep]
# Map blocks should have a single statement.
[-BuiltinFunctions::ProhibitComplexMappings]
# Use 4-argument `substr' instead of writing `substr($foo, 2, 6) = $bar'.
[BuiltinFunctions::ProhibitLvalueSubstr]
# Forbid $b before $a in sort blocks.
[BuiltinFunctions::ProhibitReverseSortBlock]
# Use Time::HiRes instead of something like `select(undef, undef, undef, .05)'.
[BuiltinFunctions::ProhibitSleepViaSelect]
# Write `eval { my $foo; bar($foo) }' instead of `eval "my $foo; bar($foo);"'.
[BuiltinFunctions::ProhibitStringyEval]
# Write `split /-/, $string' instead of `split '-', $string'.
[BuiltinFunctions::ProhibitStringySplit]
# Write `eval { $foo->can($name) }' instead of `UNIVERSAL::can($foo, $name)'.
[BuiltinFunctions::ProhibitUniversalCan]
# Write `eval { $foo->isa($pkg) }' instead of `UNIVERSAL::isa($foo, $pkg)'.
[BuiltinFunctions::ProhibitUniversalIsa]
# this normally disables this policy! run with --severity 1 to get it
severity = 1
# I'd really like to enable this, but it confuses Test::Deep::isa with
# UNIVERSAL::isa
# Don't pass $_ to built-in functions that assume it, or to most filetest operators.
[BuiltinFunctions::ProhibitUselessTopic]
# Don't use `grep' in void contexts.
[BuiltinFunctions::ProhibitVoidGrep]
# Don't use `map' in void contexts.
# disabled because it gets confused with a map inside a hash constructor
[-BuiltinFunctions::ProhibitVoidMap]
# Write `grep { /$pattern/ } @list' instead of `grep /$pattern/, @list'.
[BuiltinFunctions::RequireBlockGrep]
# Write `map { /$pattern/ } @list' instead of `map /$pattern/, @list'.
[BuiltinFunctions::RequireBlockMap]
# Use `glob q{*}' instead of <*>.
[BuiltinFunctions::RequireGlobFunction]
# Sort blocks should have a single statement.
[BuiltinFunctions::RequireSimpleSortBlock]
# AUTOLOAD methods should be avoided.
[ClassHierarchies::ProhibitAutoloading]
# Employ `use base' instead of `@ISA'.
[ClassHierarchies::ProhibitExplicitISA]
# Write `bless {}, $class;' instead of just `bless {};'.
[ClassHierarchies::ProhibitOneArgBless]
# Use spaces instead of tabs.
[CodeLayout::ProhibitHardTabs]
allow_leading_tabs = 0
# Write `open $handle, $path' instead of `open($handle, $path)'.
[CodeLayout::ProhibitParensWithBuiltins]
# Write `qw(foo bar baz)' instead of `('foo', 'bar', 'baz')'.
[CodeLayout::ProhibitQuotedWordLists]
# Don't use whitespace at the end of lines.
[CodeLayout::ProhibitTrailingWhitespace]
# Use the same newline through the source.
[CodeLayout::RequireConsistentNewlines]
# Must run code through perltidy.
[-CodeLayout::RequireTidyCode]
# Put a comma at the end of every multi-line list declaration, including the last one.
[CodeLayout::RequireTrailingCommas]
# Write `for(0..20)' instead of `for($i=0; $i<=20; $i++)'.
[ControlStructures::ProhibitCStyleForLoops]
# Don't write long "if-elsif-elsif-elsif-elsif...else" chains.
[ControlStructures::ProhibitCascadingIfElse]
# Don't write deeply nested loops and conditionals.
[ControlStructures::ProhibitDeepNests]
max_nests = 5
# Don't use labels that are the same as the special block names.
[ControlStructures::ProhibitLabelsWithSpecialBlockNames]
# Don't modify `$_' in list functions.
[ControlStructures::ProhibitMutatingListFunctions]
# Don't use operators like `not', `!~', and `le' within `until' and `unless'.
[-ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions]
# Write `if($condition){ do_something() }' instead of `do_something() if $condition'.
[-ControlStructures::ProhibitPostfixControls]
# Write `if(! $condition)' instead of `unless($condition)'.
[-ControlStructures::ProhibitUnlessBlocks]
# Don't write code after an unconditional `die, exit, or next'.
[ControlStructures::ProhibitUnreachableCode]
# Write `while(! $condition)' instead of `until($condition)'.
[ControlStructures::ProhibitUntilBlocks]
# Check your spelling.
[-Documentation::PodSpelling]
# The `=head1 NAME' section should match the package.
[-Documentation::RequirePackageMatchesPodName]
# All POD should be after `__END__'.
[-Documentation::RequirePodAtEnd]
# Provide text to display with your pod links.
[-Documentation::RequirePodLinksIncludeText]
# Organize your POD into the customary sections.
[-Documentation::RequirePodSections]
# Use functions from Carp instead of `warn' or `die'.
[ErrorHandling::RequireCarping]
# You can't depend upon the value of `$@'/`$EVAL_ERROR' to tell whether an `eval' failed.
[ErrorHandling::RequireCheckingReturnValueOfEval]
# Discourage stuff like `@files = `ls $directory`'.
[InputOutput::ProhibitBacktickOperators]
# Write `open my $fh, q{<}, $filename;' instead of `open FH, q{<}, $filename;'.
[InputOutput::ProhibitBarewordFileHandles]
severity = 2
# Use "<>" or "<ARGV>" or a prompting module instead of "<STDIN>".
[InputOutput::ProhibitExplicitStdin]
# Use prompt() instead of -t.
[InputOutput::ProhibitInteractiveTest]
# Use `local $/ = undef' or File::Slurp instead of joined readline.
[InputOutput::ProhibitJoinedReadline]
# Never write `select($fh)'.
[InputOutput::ProhibitOneArgSelect]
# Write `while( $line = <> ){...}' instead of `for(<>){...}'.
[InputOutput::ProhibitReadlineInForLoop]
# Write `open $fh, q{<}, $filename;' instead of `open $fh, "<$filename";'.
[InputOutput::ProhibitTwoArgOpen]
severity = 2
# Write `print {$FH} $foo, $bar;' instead of `print $FH $foo, $bar;'.
[-InputOutput::RequireBracedFileHandleWithPrint]
# Close filehandles as soon as possible after opening them.
[-InputOutput::RequireBriefOpen]
# Write `my $error = close $fh;' instead of `close $fh;'.
[-InputOutput::RequireCheckedClose]
# Write `my $error = open $fh, $mode, $filename;' instead of `open $fh, $mode, $filename;'.
[-InputOutput::RequireCheckedOpen]
# Return value of flagged function ignored.
[-InputOutput::RequireCheckedSyscalls]
# Write `open $fh, q{<:encoding(UTF-8)}, $filename;' instead of `open $fh, q{{<:utf8}, $filename;'.
[InputOutput::RequireEncodingWithUTF8Layer]
# Do not use `format'.
[Miscellanea::ProhibitFormats]
# Do not use `tie'.
[Miscellanea::ProhibitTies]
# Forbid a bare `## no critic'
[Miscellanea::ProhibitUnrestrictedNoCritic]
# Remove ineffective "## no critic" annotations.
[Miscellanea::ProhibitUselessNoCritic]
# Export symbols via `@EXPORT_OK' or `%EXPORT_TAGS' instead of `@EXPORT'.
[Modules::ProhibitAutomaticExportation]
# Avoid putting conditional logic around compile-time includes.
[Modules::ProhibitConditionalUseStatements]
# Minimize complexity in code that is outside of subroutines.
[Modules::ProhibitExcessMainComplexity]
max_mccabe = 20
# Put packages (especially subclasses) in separate files.
[Modules::ProhibitMultiplePackages]
severity = 2
# Write `require Module' instead of `require 'Module.pm''.
[Modules::RequireBarewordIncludes]
# End each module with an explicitly `1;' instead of some funky expression.
[Modules::RequireEndWithOne]
# Always make the `package' explicit.
[Modules::RequireExplicitPackage]
# Don't require programs to contain a package statement.
exempt_scripts = 1
allow_import_of = utf8 strict warnings
# Package declaration must match filename.
[Modules::RequireFilenameMatchesPackage]
# `use English' must be passed a `-no_match_vars' argument.
[Modules::RequireNoMatchVarsWithUseEnglish]
# Give every module a `$VERSION' number.
[Modules::RequireVersionVar]
# Distinguish different program components by case.
[NamingConventions::Capitalization]
# Don't use vague variable or subroutine names like 'last' or 'record'.
[-NamingConventions::ProhibitAmbiguousNames]
# Prohibit indirect object call syntax.
[Objects::ProhibitIndirectSyntax]
# Indirect method syntax is forbidden for these methods.
# Values that are always included: new.
# forbid =
# Write `@{ $array_ref }' instead of `@$array_ref'.
[References::ProhibitDoubleSigils]
# Capture variable used outside conditional.
[RegularExpressions::ProhibitCaptureWithoutTest]
# Names of ways to generate exceptions.
# Values that are always included: confess, croak, die.
# exception_source =
# Split long regexps into smaller `qr//' chunks.
[-RegularExpressions::ProhibitComplexRegexes]
# Use named character classes instead of explicit character lists.
[-RegularExpressions::ProhibitEnumeratedClasses]
# Use character classes for literal meta-characters instead of escapes.
[-RegularExpressions::ProhibitEscapedMetacharacters]
# Use `eq' or hash instead of fixed-pattern regexps.
[RegularExpressions::ProhibitFixedStringMatches]
# Use `[abc]' instead of `a|b|c'.
[RegularExpressions::ProhibitSingleCharAlternation]
# Only use a capturing group if you plan to use the captured value.
[RegularExpressions::ProhibitUnusedCapture]
# Use only `//' or `{}' to delimit regexps.
[RegularExpressions::ProhibitUnusualDelimiters]
# In addition to allowing '{}', allow '()', '[]', and '{}'.
#allow_all_brackets = 1
# Don't use $_ to match against regexes.
[RegularExpressions::ProhibitUselessTopic]
# Use `{' and `}' to delimit multi-line regexps.
[RegularExpressions::RequireBracesForMultiline]
# In addition to allowing '{}', allow '()', '[]', and '{}'.
#allow_all_brackets = 1
# Always use the `/s' modifier with regular expressions.
[-RegularExpressions::RequireDotMatchAnything]
# Always use the `/x' modifier with regular expressions.
[-RegularExpressions::RequireExtendedFormatting]
# Always use the `/m' modifier with regular expressions.
[-RegularExpressions::RequireLineBoundaryMatching]
# Don't call functions with a leading ampersand sigil.
[Subroutines::ProhibitAmpersandSigils]
# Don't declare your own `open' function.
[Subroutines::ProhibitBuiltinHomonyms]
# Minimize complexity by factoring code into smaller subroutines.
[Subroutines::ProhibitExcessComplexity]
# Return failure with bare `return' instead of `return undef'.
[-Subroutines::ProhibitExplicitReturnUndef]
# Too many arguments.
[Subroutines::ProhibitManyArgs]
# `sub never { sub correct {} }'.
[Subroutines::ProhibitNestedSubs]
# Behavior of `sort' is not defined if called in scalar context.
[Subroutines::ProhibitReturnSort]
# Don't write `sub my_function (@@) {}'.
[Subroutines::ProhibitSubroutinePrototypes]
severity = 2
# Prevent unused private subroutines.
[Subroutines::ProhibitUnusedPrivateSubroutines]
private_name_regex = _(?!build_)\w+
# Prevent access to private subs in other packages.
[Subroutines::ProtectPrivateSubs]
# Always unpack `@_' first.
[-Subroutines::RequireArgUnpacking]
# End every path through a subroutine with an explicit `return' statement.
[Subroutines::RequireFinalReturn]
# this normally disables this policy! run with --severity 1 to get it
severity = 1
# I'd really like to enable this, but we very often have
# single-expression subs, and this policy would warn on every one of
# them... maybe one day I'll patch the policy
# Prohibit various flavors of `no strict'.
[TestingAndDebugging::ProhibitNoStrict]
# Prohibit various flavors of `no warnings'.
[TestingAndDebugging::ProhibitNoWarnings]
allow = uninitialized numeric redefine
# Don't turn off strict for large blocks of code.
[TestingAndDebugging::ProhibitProlongedStrictureOverride]
# The maximum number of statements in a no strict block.
statements = 10
# Tests should all have labels.
[TestingAndDebugging::RequireTestLabels]
# Always `use strict'.
[TestingAndDebugging::RequireUseStrict]
# Always `use warnings'.
[TestingAndDebugging::RequireUseWarnings]
# Don't use the comma operator as a statement separator.
[ValuesAndExpressions::ProhibitCommaSeparatedStatements]
# this normally disables this policy! run with --severity 1 to get it
severity = 1
# I'd like to enable this, but it complains about arglists built with
# ternary operators
# Prohibit version values from outside the module.
[ValuesAndExpressions::ProhibitComplexVersion]
# Don't `use constant FOO => 15'.
[ValuesAndExpressions::ProhibitConstantPragma]
# Write `q{}' instead of `'''.
[-ValuesAndExpressions::ProhibitEmptyQuotes]
# Write `"\N{DELETE}"' instead of `"\x7F"', etc.
[-ValuesAndExpressions::ProhibitEscapedCharacters]
# Use concatenation or HEREDOCs instead of literal line breaks in strings.
[ValuesAndExpressions::ProhibitImplicitNewlines]
# Always use single quotes for literal strings.
[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
# Write `oct(755)' instead of `0755'.
[ValuesAndExpressions::ProhibitLeadingZeros]
# Long chains of method calls indicate tightly coupled code.
[-ValuesAndExpressions::ProhibitLongChainsOfMethodCalls]
# Don't use values that don't explain themselves.
[-ValuesAndExpressions::ProhibitMagicNumbers]
# Don't mix numeric operators with string operands, or vice-versa.
[ValuesAndExpressions::ProhibitMismatchedOperators]
# Write ` !$foo && $bar || $baz ' instead of ` not $foo && $bar or $baz'.
[ValuesAndExpressions::ProhibitMixedBooleanOperators]
# Use `q{}' or `qq{}' instead of quotes for awkward-looking strings.
[-ValuesAndExpressions::ProhibitNoisyQuotes]
# Don't use quotes (`'', `"', ``') as delimiters for the quote-like operators.
[ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters]
# Don't write ` print <<'__END__' '.
[ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator]
# Don't use strings like `v1.4' or `1.4.5' when including other modules.
[ValuesAndExpressions::ProhibitVersionStrings]
# Require $VERSION to be a constant rather than a computed value.
[ValuesAndExpressions::RequireConstantVersion]
# Warns that you might have used single quotes when you really wanted double-quotes.
[-ValuesAndExpressions::RequireInterpolationOfMetachars]
# Write ` 141_234_397.0145 ' instead of ` 141234397.0145 '.
[-ValuesAndExpressions::RequireNumberSeparators]
# Write ` print <<'THE_END' ' or ` print <<"THE_END" '.
[ValuesAndExpressions::RequireQuotedHeredocTerminator]
# Write ` <<'THE_END'; ' instead of ` <<'theEnd'; '.
[ValuesAndExpressions::RequireUpperCaseHeredocTerminator]
# Do not write ` my $foo .= 'bar'; '.
[-Variables::ProhibitAugmentedAssignmentInDeclaration]
# Do not write ` my $foo = $bar if $baz; '.
[Variables::ProhibitConditionalDeclarations]
# Use `my' instead of `local', except when you have to.
[-Variables::ProhibitLocalVars]
# Avoid `$`', `$&', `$'' and their English equivalents.
[Variables::ProhibitMatchVars]
# Eliminate globals declared with `our' or `use vars'.
[Variables::ProhibitPackageVars]
# Use double colon (::) to separate package name components instead of single quotes (').
[Variables::ProhibitPerl4PackageNames]
# Write `$EVAL_ERROR' instead of `$@'.
[-Variables::ProhibitPunctuationVars]
# Do not reuse a variable name in a lexical scope
[Variables::ProhibitReusedNames]
# Don't ask for storage you don't need.
[Variables::ProhibitUnusedVariables]
# Prevent access to private vars in other packages.
[Variables::ProtectPrivateVars]
# Write `local $foo = $bar;' instead of just `local $foo;'.
[-Variables::RequireInitializationForLocalVars]
# Write `for my $element (@list) {...}' instead of `for $element (@list) {...}'.
[Variables::RequireLexicalLoopIterators]
# Magic variables should be assigned as "local".
[Variables::RequireLocalizedPunctuationVars]
allow = %ENV
# Negative array index should be used.
[Variables::RequireNegativeIndices]
|