Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Perl::Criticの警告一覧

Perl::Criticのエラー

これの車輪の再発明っぽい: PolicySummary.pod

Perl::Critic の警告 内容
ProhibitBooleanGrep Use List::MoreUtils::any instead of grep in boolean context.
ProhibitComplexMappings Map blocks should have a single statement.
ProhibitLvalueSubstr Use 4-argument substr instead of writing substr($foo, 2, 6) = $bar.
ProhibitReverseSortBlock Forbid $b before $a in sort blocks.
ProhibitSleepViaSelect Use Time::HiRes instead of something like select(undef, undef, undef, .05).
ProhibitStringyEval Write eval { my $foo; bar($foo) } instead of eval "my $foo; bar($foo);".
ProhibitStringySplit Write split /-/, $string instead of split '-', $string.
ProhibitUniversalCan Write < eval { $foo-can($name) } >> instead of UNIVERSAL::can($foo, $name).
ProhibitUniversalIsa Write < eval { $foo-isa($pkg) } >> instead of UNIVERSAL::isa($foo, $pkg).
ProhibitVoidGrep Don't use grep in void contexts.
ProhibitVoidMap Don't use map in void contexts.
RequireBlockGrep Write grep { $_ =~ /$pattern/ } @list instead of grep /$pattern/, @list.
RequireBlockMap Write map { $_ =~ /$pattern/ } @list instead of map /$pattern/, @list.
RequireGlobFunction Use glob q{} instead of <>.
RequireSimpleSortBlock Sort blocks should have a single statement.
ProhibitAutoloading AUTOLOAD methods should be avoided.
ProhibitExplicitISA Employ use base instead of @ISA.
ProhibitOneArgBless Write bless {}, $class; instead of just bless {};.
ProhibitHardTabs Use spaces instead of tabs.
ProhibitParensWithBuiltins Write open $handle, $path instead of open($handle, $path).
ProhibitQuotedWordLists Write qw(foo bar baz) instead of ('foo', 'bar', 'baz').
ProhibitTrailingWhitespace Don't use whitespace at the end of lines.
RequireConsistentNewlines Use the same newline through the source.
RequireTidyCode Must run code through perltidy.
RequireTrailingCommas Put a comma at the end of every multi-line list declaration, including the last one.
ProhibitCStyleForLoops Write for(0..20) instead of for($i=0; $i<=20; $i++).
ProhibitCascadingIfElse Don't write long "if-elsif-elsif-elsif-elsif...else" chains.
ProhibitDeepNests Don't write deeply nested loops and conditionals.
ProhibitLabelsWithSpecialBlockNames Don't use labels that are the same as the special block names.
ProhibitMutatingListFunctions Don't modify $_ in list functions.
ProhibitNegativeExpressionsInUnlessAndUntilConditions Don't use operators like not, !~, and le within until and unless.
ProhibitPostfixControls Write if($condition){ do_something() } instead of do_something() if $condition.
ProhibitUnlessBlocks Write if(! $condition) instead of unless($condition).
ProhibitUnreachableCode Don't write code after an unconditional die, exit, or next.
ProhibitUntilBlocks Write while(! $condition) instead of until($condition).
PodSpelling Check your spelling.
RequirePackageMatchesPodName The =head1 NAME section should match the package.
RequirePodAtEnd All POD should be after END.
RequirePodLinksIncludeText Provide text to display with your pod links.
RequirePodSections Organize your POD into the customary sections.
RequireCarping Use functions from Carp instead of warn or die.
RequireCheckingReturnValueOfEval You can't depend upon the value of $@/$EVAL_ERROR to tell whether an eval failed.
ProhibitBacktickOperators Discourage stuff like @files = ls $directory.
ProhibitBarewordFileHandles Write open my $fh, q{<}, $filename; instead of open FH, q{<}, $filename;.
ProhibitExplicitStdin Use "<>" or "" or a prompting module instead of "".
ProhibitInteractiveTest Use prompt() instead of -t.
ProhibitJoinedReadline Use local $/ = undef or File::Slurp instead of joined readline.
ProhibitOneArgSelect Never write select($fh).
ProhibitReadlineInForLoop Write < while( $line = < ){...} >> instead of < for(<){...} >>.
ProhibitTwoArgOpen Write < open $fh, q{<}, $filename; > instead of < open $fh, "<$filename"; >.
RequireBracedFileHandleWithPrint Write print {$FH} $foo, $bar; instead of print $FH $foo, $bar;.
RequireBriefOpen Close filehandles as soon as possible after opening them.
RequireCheckedClose Write < my $error = close $fh; > instead of < close $fh; >.
RequireCheckedOpen Write < my $error = open $fh, $mode, $filename; > instead of < open $fh, $mode, $filename; >.
RequireCheckedSyscalls Return value of flagged function ignored.
RequireEncodingWithUTF8Layer Write < open $fh, q{<:encoding(UTF-8)}, $filename; > instead of < open $fh, q{{<:utf8}, $filename; >.
ProhibitFormats Do not use format.
ProhibitTies Do not use tie.
ProhibitUnrestrictedNoCritic Forbid a bare ## no critic
ProhibitUselessNoCritic Remove ineffective "## no critic" annotations.
ProhibitAutomaticExportation Export symbols via @EXPORT_OK or %EXPORT_TAGS instead of @EXPORT.
ProhibitConditionalUseStatements Avoid putting conditional logic around compile-time includes.
ProhibitEvilModules Ban modules that aren't blessed by your shop.
ProhibitExcessMainComplexity Minimize complexity in code that is outside of subroutines.
ProhibitMultiplePackages Put packages (especially subclasses) in separate files.
RequireBarewordIncludes Write require Module instead of require 'Module.pm'.
RequireEndWithOne End each module with an explicitly 1; instead of some funky expression.
RequireExplicitPackage Always make the package explicit.
RequireFilenameMatchesPackage Package declaration must match filename.
RequireNoMatchVarsWithUseEnglish use English must be passed a -no_match_vars argument.
RequireVersionVar Give every module a $VERSION number.
Capitalization Distinguish different program components by case.
ProhibitAmbiguousNames Don't use vague variable or subroutine names like 'last' or 'record'.
ProhibitIndirectSyntax Prohibit indirect object call syntax.
ProhibitDoubleSigils Write @{ $array_ref } instead of @$array_ref.
ProhibitCaptureWithoutTest Capture variable used outside conditional.
ProhibitComplexRegexes Split long regexps into smaller qr// chunks.
ProhibitEnumeratedClasses Use named character classes instead of explicit character lists.
ProhibitEscapedMetacharacters Use character classes for literal meta-characters instead of escapes.
ProhibitFixedStringMatches Use eq or hash instead of fixed-pattern regexps.
ProhibitSingleCharAlternation Use [abc] instead of a.
ProhibitUnusedCapture Only use a capturing group if you plan to use the captured value.
ProhibitUnusualDelimiters Use only // or {} to delimit regexps.
RequireBracesForMultiline Use { and } to delimit multi-line regexps.
RequireDotMatchAnything Always use the /s modifier with regular expressions.
RequireExtendedFormatting Always use the /x modifier with regular expressions.
RequireLineBoundaryMatching Always use the /m modifier with regular expressions.
ProhibitAmpersandSigils Don't call functions with a leading ampersand sigil.
ProhibitBuiltinHomonyms Don't declare your own open function.
ProhibitExcessComplexity Minimize complexity by factoring code into smaller subroutines.
ProhibitExplicitReturnUndef Return failure with bare return instead of return undef.
ProhibitManyArgs Too many arguments.
ProhibitNestedSubs sub never { sub correct {} }.
ProhibitReturnSort Behavior of sort is not defined if called in scalar context.
ProhibitSubroutinePrototypes Don't write sub my_function (@@) {}.
ProhibitUnusedPrivateSubroutines Prevent unused private subroutines.
ProtectPrivateSubs Prevent access to private subs in other packages.
RequireArgUnpacking Always unpack @_ first.
RequireFinalReturn End every path through a subroutine with an explicit return statement.
ProhibitNoStrict Prohibit various flavors of no strict.
ProhibitNoWarnings Prohibit various flavors of no warnings.
ProhibitProlongedStrictureOverride Don't turn off strict for large blocks of code.
RequireTestLabels Tests should all have labels.
RequireUseStrict Always use strict.
RequireUseWarnings Always use warnings.
ProhibitCommaSeparatedStatements Don't use the comma operator as a statement separator.
ProhibitComplexVersion Prohibit version values from outside the module.
ProhibitConstantPragma Don't < use constant FOO = 15 >>.
ProhibitEmptyQuotes Write q{} instead of ''.
ProhibitEscapedCharacters Write "\N{DELETE}" instead of "\x7F", etc.
ProhibitImplicitNewlines Use concatenation or HEREDOCs instead of literal line breaks in strings.
ProhibitInterpolationOfLiterals Always use single quotes for literal strings.
ProhibitLeadingZeros Write oct(755) instead of 0755.
ProhibitLongChainsOfMethodCalls Long chains of method calls indicate tightly coupled code.
ProhibitMagicNumbers Don't use values that don't explain themselves.
ProhibitMismatchedOperators Don't mix numeric operators with string operands, or vice-versa.
ProhibitMixedBooleanOperators Write !$foo && $bar instead of not $foo && $bar or $baz.
ProhibitNoisyQuotes Use q{} or qq{} instead of quotes for awkward-looking strings.
ProhibitQuotesAsQuotelikeOperatorDelimiters Don't use quotes (', ", `) as delimiters for the quote-like operators.
ProhibitSpecialLiteralHeredocTerminator Don't write print <<'END' .
ProhibitVersionStrings Don't use strings like v1.4 or 1.4.5 when including other modules.
RequireConstantVersion Require $VERSION to be a constant rather than a computed value.
RequireInterpolationOfMetachars Warns that you might have used single quotes when you really wanted double-quotes.
RequireNumberSeparators Write 141_234_397.0145 instead of 141234397.0145 .
RequireQuotedHeredocTerminator Write print <<'THE_END' or print <<"THE_END" .
RequireUpperCaseHeredocTerminator Write <<'THE_END'; instead of <<'theEnd'; .
ProhibitAugmentedAssignmentInDeclaration Do not write my $foo .= 'bar'; .
ProhibitConditionalDeclarations Do not write my $foo = $bar if $baz; .
ProhibitEvilVariables Ban variables that aren't blessed by your shop.
ProhibitLocalVars Use my instead of local, except when you have to.
ProhibitMatchVars Avoid $`, $&, $' and their English equivalents.
ProhibitPackageVars Eliminate globals declared with our or use vars.
ProhibitPerl4PackageNames Use double colon (::) to separate package name components instead of single quotes (').
ProhibitPunctuationVars Write $EVAL_ERROR instead of $@.
ProhibitReusedNames Do not reuse a variable name in a lexical scope
ProhibitUnusedVariables Don't ask for storage you don't need.
ProtectPrivateVars Prevent access to private vars in other packages.
RequireInitializationForLocalVars Write local $foo = $bar; instead of just local $foo;.
RequireLexicalLoopIterators Write for my $element (@list) {...} instead of for $element (@list) {...}.
RequireLocalizedPunctuationVars Magic variables should be assigned as "local".
RequireNegativeIndices Negative array index should be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.