Perl Critic distributions and policies
Perl::Critic is configurable lint-like static analyzer for Perl that can provide recommendations how to improve your code andcan even locate code snippets that are sources of common errors. It has a base library that provides the engine and a large set ofpolicies (things to be checked). In addition there are a number of distributions on CPAN that provide further policies.
In this article we collect all the CPAN distributions related to Perl::Critic and all the policies available.
Articles
- Getting Started with Perl::Critic (the linter for Perl)
- Avoid (unwanted) bitwise operators using Perl::Critic::Bangs
- Bare Here documents are deprecated - How to find offending code? using the core ValuesAndExpressions::RequireQuotedHeredocTerminator policy.
- How to improve my Perl program? - just use Perl::Critic
- Improving your Perl code - one Perl::Critic policy at a time
- Move packages to their own files - release Pod::Tree 1.21 part of the Refactoring and CPAN co-maintainer series.
- Type checking with Moo recommends the use of the ValuesAndExpressions::ProhibitAccessOfPrivateData policy from Perl::Critic::Nits.
- Private Member Data shouldn't be accessed directly - encapsulation violation
- Always require explicit importing of functions
Interviews
Other Articles
- An Introduction To Perl Critic slides from 2007
- Automatically review your code
- Integrating perlcritic and vim
- Perl::Critic at CERN Computer Security Information
- Cleaning Up Perl (Chapter 7 of Mastering Perl)
- Module of the month November 2014
- Format perlcritic output as TAP to integrate with Jenkins
Distributions
Distribution | Abstract | Author | Date |
---|---|---|---|
Perl-Critic | Critique Perl source code for best-practices. | THALJEF | 2015-03-03T05:40:47 |
Perl-Critic-Lax | policies that let you slide on common exceptions | RJBS | 2014-07-11T03:41:56 |
Perl-Critic-Tics | policies for things that make me wince | RJBS | 2014-07-28T19:26:56 |
Perl-Critic-More | Supplemental policies for Perl::Critic | THALJEF | 2013-10-29T16:43:05 |
Perl-Critic-Lokku | A collection of Perl::Critic policies from Lokku | FLIMM | 2015-03-02T16:47:32 |
Perl-Critic-Swift | A set of additional policies for Perl::Critic. | ELLIOTJS | 2008-05-04T00:41:35 |
Perl-Critic-Git | Bond git and Perl::Critic to blame the right people for violations. | AUBERTG | 2014-04-21T03:18:51 |
Perl-Critic-Bangs | Perl::Critic::Bangs - A collection of policies for Perl::Critic | PETDANCE | 2012-08-20T20:02:43 |
Perl-Critic-Moose | Policies for Perl::Critic concerned with using Moose | DROLSKY | 2015-05-31T17:16:12 |
Perl-Critic-Itch | Perl::Critic::Itch - A collection of Policies to solve some Itches | MARCELO | 2009-05-30T23:56:12 |
Perl-Critic-Pulp | Some add-on policies for Perl::Critic. | KRYDE | 2015-03-07T08:21:45 |
Perl-Critic-Nits | policies of nits I like to pick. | KCOWGILL | 2007-09-14T22:09:08 |
Perl-Critic-Dynamic | Dynamic policies for Perl::Critic. | THALJEF | 2010-09-30T22:07:27 |
Perl-Critic-RENEEB | A collection of handy Perl::Critic policies | RENEEB | 2015-02-23T20:01:57 |
Perl-Critic-logicLAB | Perl::Critic policies implemented and used by logicLAB | JONASBN | 2014-08-08T19:20:39 |
Perl-Critic-Storable | policy for Storable.pm | MATTD | 2008-08-11T09:02:00 |
Perl-Critic-StricterSubs | Perl::Critic plugin for stricter subroutine checking | THALJEF | 2015-02-20T18:52:59 |
Perl-Critic-Compatibility | Policies for Perl::Critic concerned with compatibility with various versions of Perl. | ELLIOTJS | 2008-06-17T20:59:00 |
Perl-Critic-Policy-Perlsecret | Prevent perlsecrets entering your codebase | LANCEW | 2014-09-14T20:41:25 |
Perl-Critic-Policy-CompileTime | Find code that runs in compile-time blocks | XAN | 2014-09-26T20:34:02 |
Perl-Critic-PetPeeves-JTRAMMELL | policies to prohibit/require my pet peeves | JTRAMMELL | 2014-04-28T19:13:24 |
Test-Perl-Critic | Use Perl::Critic in test programs. | THALJEF | 2015-02-03T18:45:55 |
Perl-Critic-Deprecated | Policies and modules that were formerly included with Perl::Critic itself, but which have been superseded by others. | THALJEF | 2013-10-29T16:43:17 |
Perl-Critic-OTRS | A collection of handy Perl::Critic policies | RENEEB | 2015-01-25T08:27:30 |
Perl-Critic-Policy-CodeLayout-ProhibitSpaceIndentation | Use tabs instead of spaces for indentation. | IXA | 2012-10-04T23:30:39 |
Perl-Critic-Policy-CodeLayout-TabIndentSpaceAlign | Use tabs for indenting, spaces for aligning. | AUBERTG | 2014-06-09T07:06:32 |
Perl-Critic-Policy-Dynamic-NoIndirect | Perl::Critic policy against indirect method calls. | VPIT | 2011-08-25T14:55:26 |
Perl-Critic-Policy-References-ProhibitComplexDoubleSigils | allow $$foo | XENU | 2015-03-14T21:17:38 |
Perl-Critic-Policy-ValuesAndExpressions-PreventSQLInjection | Prevent SQL injection in interpolated strings. | AUBERTG | 2014-04-21T03:30:39 |
Perl-Critic-Policy-Variables-ProhibitUnusedVarsStricter | Critique unused variables in Perl source | WYANT | 2014-12-12T16:04:02 |
Perl-Critic-Policy-logicLAB-ModuleBlacklist | blacklist modules you want to prohibit use of | JONASBN | 2014-08-28T15:53:27 |
Perl-Critic-Policy-logicLAB-ProhibitShellDispatch | simple policy prohibiting dispatching to shell | JONASBN | 2014-01-24T20:36:34 |
Perl-Critic-Policy-logicLAB-ProhibitUseLib | simple policy prohibiting the use of 'use lib' | JONASBN | 2014-02-27T14:56:27 |
Perl-Critic-Policy-logicLAB-RequirePackageNamePattern | simple policy for enforcing a package naming policy | JONASBN | 2014-03-09T16:12:12 |
Perl-Critic-Policy-logicLAB-RequireParamsValidate | simple policy for enforcing use of Params::Validate | JONASBN | 2014-03-05T21:34:18 |
Perl-Critic-Policy-logicLAB-RequireSheBang | simple policy asserting she bang line | JONASBN | 2014-08-11T19:31:04 |
Perl-Critic-Policy-logicLAB-RequireVersionFormat | a simple policy enforcing strict version formatting | JONASBN | 2014-08-11T19:35:06 |
Policies
Name | Severity | Abstract |
---|---|---|
BuiltinFunctions::ProhibitBooleanGrep | 5 | Use List::MoreUtils::any instead of grep in boolean context. |
BuiltinFunctions::ProhibitComplexMappings | 5 | Map blocks should have a single statement. |
BuiltinFunctions::ProhibitLvalueSubstr | 5 | Use 4-argument substr instead of writing substr($foo, 2, 6) = $bar. |
BuiltinFunctions::ProhibitReverseSortBlock | 5 | Forbid $b before $a in sort blocks. |
BuiltinFunctions::ProhibitSleepViaSelect | 5 | Use Time::HiRes instead of something like select(undef, undef, undef, .05). |
BuiltinFunctions::ProhibitStringyEval | 5 | Write eval { my $foo; bar($foo) } instead of eval "my $foo; bar($foo);". |
BuiltinFunctions::ProhibitStringySplit | 5 | Write split /-/, $string instead of split '-', $string. |
BuiltinFunctions::ProhibitUniversalCan | 5 | Write < eval { $foo-can($name) } >> instead of UNIVERSAL::can($foo, $name). |
BuiltinFunctions::ProhibitUniversalIsa | 5 | Write < eval { $foo-isa($pkg) } >> instead of UNIVERSAL::isa($foo, $pkg). |
BuiltinFunctions::ProhibitUselessTopic | 5 | Don't pass $_ to built-in functions that assume it, or to most filetest operators. |
BuiltinFunctions::ProhibitVoidGrep | 5 | Don't use grep in void contexts. |
BuiltinFunctions::ProhibitVoidMap | 5 | Don't use map in void contexts. |
BuiltinFunctions::RequireBlockGrep | 5 | Write grep { /$pattern/ } @list instead of grep /$pattern/, @list. |
BuiltinFunctions::RequireBlockMap | 5 | Write map { /$pattern/ } @list instead of map /$pattern/, @list. |
BuiltinFunctions::RequireGlobFunction | 5 | Use glob q{*} instead of <*>. |
BuiltinFunctions::RequireSimpleSortBlock | 5 | Sort blocks should have a single statement. |
ClassHierarchies::ProhibitAutoloading | 5 | AUTOLOAD methods should be avoided. |
ClassHierarchies::ProhibitExplicitISA | 5 | Employ use base instead of @ISA. |
ClassHierarchies::ProhibitOneArgBless | 5 | Write bless {}, $class; instead of just bless {};. |
CodeLayout::ProhibitFatCommaNewline | 5 | keep a fat comma on the same line as its quoted word |
CodeLayout::ProhibitHardTabs | 5 | Use spaces instead of tabs. |
CodeLayout::ProhibitIfIfSameLine | 5 | don't put if after if on same line |
CodeLayout::ProhibitParensWithBuiltins | 5 | Write open $handle, $path instead of open($handle, $path). |
CodeLayout::ProhibitQuotedWordLists | 5 | Write qw(foo bar baz) instead of ('foo', 'bar', 'baz'). |
CodeLayout::ProhibitTrailingWhitespace | 5 | Don't use whitespace at the end of lines. |
CodeLayout::RequireASCII | 5 | Disallow high-bit characters. |
CodeLayout::RequireConsistentNewlines | 5 | Use the same newline through the source. |
CodeLayout::RequireFinalSemicolon | 5 | require a semicolon at the end of code blocks |
CodeLayout::RequireTidyCode | 5 | Must run code through perltidy. |
CodeLayout::RequireTrailingCommaAtNewline | 5 | comma at end of list at newline |
CodeLayout::RequireTrailingCommas | 5 | Put a comma at the end of every multi-line list declaration, including the last one. |
CodeLayout::RequireUseUTF8 | 5 | Require that all modules have a use utf8; statement. |
CodeLayout::TabIndentSpaceAlign | 5 | Use tabs for indenting, spaces for aligning. |
Compatibility::ConstantLeadingUnderscore | 5 | new enough "constant" module for leading underscores |
Compatibility::ConstantPragmaHash | 5 | new enough "constant" module for multiple constants |
Compatibility::Gtk2Constants | 5 | new enough Gtk2 version for its constants |
Compatibility::PerlMinimumVersionAndWhy | ||
Compatibility::PodMinimumVersion | ||
Compatibility::ProhibitThreeArgumentOpen | 5 | Don't allow three-argument open unless the code uses a version of perl that supports it. |
Compatibility::ProhibitUnixDevNull | 5 | don't use explicit /dev/null |
CompileTime | 4 | Provide Perl::Critic support for hunting down compile-time side effects |
ControlStructures::ProhibitCascadingIfElse | 5 | Don't write long "if-elsif-elsif-elsif-elsif...else" chains. |
ControlStructures::ProhibitCStyleForLoops | 5 | Write for(0..20) instead of for($i=0; $i<=20; $i++). |
ControlStructures::ProhibitDeepNests | 5 | Don't write deeply nested loops and conditionals. |
ControlStructures::ProhibitLabelsWithSpecialBlockNames | 5 | Don't use labels that are the same as the special block names. |
ControlStructures::ProhibitMutatingListFunctions | 5 | Don't modify $_ in list functions. |
ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions | 5 | Don't use operators like not, !~, and le within until and unless. |
ControlStructures::ProhibitPostfixControls | 5 | Write if($condition){ do_something() } instead of do_something() if $condition. |
ControlStructures::ProhibitUnlessBlocks | 5 | Write if(! $condition) instead of unless($condition). |
ControlStructures::ProhibitUnreachableCode | 5 | Don't write code after an unconditional die, exit, or next. |
ControlStructures::ProhibitUntilBlocks | 5 | Write while(! $condition) instead of until($condition). |
Documentation::PodSpelling | 5 | Check your spelling. |
Documentation::ProhibitAdjacentLinks | ||
Documentation::ProhibitAdjacentLinks::Parser | ||
Documentation::ProhibitBadAproposMarkup | ||
Documentation::ProhibitDuplicateHeadings | ||
Documentation::ProhibitDuplicateSeeAlso | ||
Documentation::ProhibitLinkToSelf | ||
Documentation::ProhibitParagraphEndComma | ||
Documentation::ProhibitParagraphTwoDots | ||
Documentation::ProhibitUnbalancedParens | ||
Documentation::ProhibitVerbatimMarkup | ||
Documentation::RequireEndBeforeLastPod | 5 | require __END__ before POD at end of file |
Documentation::RequireFilenameMarkup | ||
Documentation::RequireFinalCut | ||
Documentation::RequireLinkedURLs | ||
Documentation::RequirePackageMatchesPodName | 5 | The =head1 NAME section should match the package. |
Documentation::RequirePodAtEnd | 5 | All POD should be after __END__. |
Documentation::RequirePodLinksIncludeText | 5 | Provide text to display with your pod links. |
Documentation::RequirePodSections | 5 | Organize your POD into the customary sections. |
Documentation::RequirePODUseEncodingUTF8 | 5 | Require that all modules that contain POD have a =encoding utf8 declaration. |
Dynamic::ValidateAgainstSymbolTable | 5 | |
Editor::RequireEmacsFileVariables | 5 | Per-file editor settings. |
ErrorHandling::RequireCarping | 5 | Use functions from Carp instead of warn or die. |
ErrorHandling::RequireCheckingReturnValueOfEval | 5 | You can't depend upon the value of $@/$EVAL_ERROR to tell whether an eval failed. |
ErrorHandling::RequireUseOfExceptions | 5 | Use exceptions instead of die, croak, or confess. |
InputOutput::ProhibitBacktickOperators | 5 | Discourage stuff like @files = `ls $directory`. |
InputOutput::ProhibitBarewordFileHandles | 5 | Write open my $fh, q{<}, $filename; instead of open FH, q{<}, $filename;. |
InputOutput::ProhibitExplicitStdin | 5 | Use "<>" or " |
InputOutput::ProhibitInteractiveTest | 5 | Use prompt() instead of -t. |
InputOutput::ProhibitJoinedReadline | 5 | Use local $/ = undef or File::Slurp instead of joined readline. |
InputOutput::ProhibitOneArgSelect | 5 | Never write select($fh). |
InputOutput::ProhibitReadlineInForLoop | 5 | Write < while( $line = < ){...} >> instead of < for(<){...} >>. |
InputOutput::ProhibitTwoArgOpen | 5 | Write < open $fh, q{<}, $filename; > instead of < open $fh, "<$filename"; >. |
InputOutput::RequireBracedFileHandleWithPrint | 5 | Write print {$FH} $foo, $bar; instead of print $FH $foo, $bar;. |
InputOutput::RequireBriefOpen | 5 | Close filehandles as soon as possible after opening them. |
InputOutput::RequireCheckedClose | 5 | Write < my $error = close $fh; > instead of < close $fh; >. |
InputOutput::RequireCheckedOpen | 5 | Write < my $error = open $fh, $mode, $filename; > instead of < open $fh, $mode, $filename; >. |
InputOutput::RequireCheckedSyscalls | 5 | Return value of flagged function ignored. |
InputOutput::RequireEncodingWithUTF8Layer | 5 | Write < open $fh, q{<:encoding(UTF-8)}, $filename; > instead of < open $fh, q{{<:utf8}, $filename; >. |
Lax::ProhibitComplexMappings::LinesNotStatements | 6 | prohibit multiline maps, not multistatement maps |
Lax::ProhibitEmptyQuotes::ExceptAsFallback | 6 | empty quotes are okay as the fallback on the rhs of || |
Lax::ProhibitLeadingZeros::ExceptChmod | 6 | leading zeroes are okay as the first arg to chmod |
Lax::ProhibitStringyEval::ExceptForRequire | 6 | stringy eval is bad, but it's okay just to "require" |
Lax::RequireEndWithTrueConst | 5 | ending your package with a simple, fun true value is okay |
Lax::RequireExplicitPackage::ExceptForPragmata | 6 | you can put strict and warnings before "package" |
logicLAB::ModuleBlacklist | 5 | blacklist modules you want to prohibit use of |
logicLAB::ProhibitShellDispatch | 5 | simple policy prohibiting shell dispatching |
logicLAB::ProhibitUseLib | 5 | simple policy prohibiting the use of 'use lib' |
logicLAB::RequirePackageNamePattern | 5 | simple policy for enforcing a package naming policy |
logicLAB::RequireParamsValidate | 5 | simple policy for enforcing use of Params::Validate |
logicLAB::RequireSheBang | 5 | simple policy for keeping your shebang line uniform |
logicLAB::RequireVersionFormat | 5 | assert version number formats |
Miscellanea::ProhibitFormats | 5 | Do not use format. |
Miscellanea::ProhibitTies | 5 | Do not use tie. |
Miscellanea::ProhibitUnrestrictedNoCritic | 5 | Forbid a bare ## no critic |
Miscellanea::ProhibitUselessNoCritic | 5 | Remove ineffective "## no critic" annotations. |
Miscellanea::RequireRcsKeywords | 5 | Put source-control keywords in every file. |
Miscellanea::TextDomainPlaceholders | 5 | check placeholder names in Locale::TextDomain calls |
Miscellanea::TextDomainUnused | 5 | check for Locale::TextDomain imported but unused |
Modules::PerlMinimumVersion | 5 | Enforce backward compatible code. |
Modules::ProhibitAutomaticExportation | 5 | Export symbols via @EXPORT_OK or %EXPORT_TAGS instead of @EXPORT. |
Modules::ProhibitConditionalUseStatements | 5 | Avoid putting conditional logic around compile-time includes. |
Modules::ProhibitEvilModules | 5 | Ban modules that aren't blessed by your shop. |
Modules::ProhibitExcessMainComplexity | 5 | Minimize complexity in code that is outside of subroutines. |
Modules::ProhibitModuleShebang | 5 | don't put a #! line at the start of a module file |
Modules::ProhibitMultiplePackages | 5 | Put packages (especially subclasses) in separate files. |
Modules::ProhibitPOSIXimport | 5 | don't import the whole of POSIX into a module |
Modules::ProhibitUseQuotedVersion | 5 | avoid quoted version number string in a "use" statement |
Modules::RequireBarewordIncludes | 5 | Write require Module instead of require 'Module.pm'. |
Modules::RequireEndWithOne | 5 | End each module with an explicitly 1; instead of some funky expression. |
Modules::RequireExplicitInclusion | 5 | |
Modules::RequireExplicitPackage | 5 | Always make the package explicit. |
Modules::RequireFilenameMatchesPackage | 5 | Package declaration must match filename. |
Modules::RequireNoMatchVarsWithUseEnglish | 5 | use English must be passed a -no_match_vars argument. |
Modules::RequirePerlVersion | 5 | Require a use 5.006; or similar. |
Modules::RequireVersionVar | 5 | Give every module a $VERSION number. |
Moose::ProhibitDESTROYMethod | 5 | Use DEMOLISH instead of DESTROY |
Moose::ProhibitMultipleWiths | 5 | Require role composition |
Moose::ProhibitNewMethod | 5 | Don't override Moose's standard constructors. |
Moose::RequireCleanNamespace | 5 | Require removing implementation details from you packages. |
Moose::RequireMakeImmutable | 5 | Ensure that you've made your Moose code fast |
NamingConventions::Capitalization | 5 | Distinguish different program components by case. |
NamingConventions::ProhibitAmbiguousNames | 5 | Don't use vague variable or subroutine names like 'last' or 'record'. |
NamingConventions::ProhibitMixedCaseSubs | 5 | Write sub my_function{} instead of sub MyFunction{}. |
NamingConventions::ProhibitMixedCaseVars | 5 | Write $my_variable = 42 instead of $MyVariable = 42. |
Objects::ProhibitIndirectSyntax | 5 | Prohibit indirect object call syntax. |
OTRS::ProhibitDumper | 5 | |
OTRS::ProhibitFetchrowHashref | 5 | |
OTRS::ProhibitLocaltime | 5 | |
OTRS::ProhibitLowPrecedenceOps | 5 | |
OTRS::ProhibitOpen | 5 | |
OTRS::ProhibitPushISA | 5 | |
OTRS::ProhibitRequire | 5 | |
OTRS::ProhibitRmtree | 5 | |
OTRS::ProhibitSomeCoreFunctions | 5 | |
OTRS::RequireCamelCase | 5 | |
OTRS::RequireParensWithMethods | 5 | |
OTRS::RequireTrueReturnValueForModules | 5 | |
Perlsecret | 4 | Prevent perlsecrets entering your codebase |
References::ProhibitComplexDoubleSigils | 5 | allow $$foo but not $$foo[1]-E |
References::ProhibitDoubleSigils | 5 | Write @{ $array_ref } instead of @$array_ref. |
RegularExpressions::ProhibitCaptureWithoutTest | 5 | Capture variable used outside conditional. |
RegularExpressions::ProhibitComplexRegexes | 5 | Split long regexps into smaller qr// chunks. |
RegularExpressions::ProhibitEnumeratedClasses | 5 | Use named character classes instead of explicit character lists. |
RegularExpressions::ProhibitEscapedMetacharacters | 5 | Use character classes for literal meta-characters instead of escapes. |
RegularExpressions::ProhibitFixedStringMatches | 5 | Use eq or hash instead of fixed-pattern regexps. |
RegularExpressions::ProhibitSingleCharAlternation | 5 | Use [abc] instead of a. |
RegularExpressions::ProhibitUnusedCapture | 5 | Only use a capturing group if you plan to use the captured value. |
RegularExpressions::ProhibitUnusualDelimiters | 5 | Use only // or {} to delimit regexps. |
RegularExpressions::ProhibitUselessTopic | 5 | Don't use $_ to match against regexes. |
RegularExpressions::RequireBracesForMultiline | 5 | Use { and } to delimit multi-line regexps. |
RegularExpressions::RequireDotMatchAnything | 5 | Always use the /s modifier with regular expressions. |
RegularExpressions::RequireExtendedFormatting | 5 | Always use the /x modifier with regular expressions. |
RegularExpressions::RequireExtendedFormattingExceptForSplit | 5 | Always use the /x modifier with regular expressions, except when the regex is used |
RegularExpressions::RequireLineBoundaryMatching | 5 | Always use the /m modifier with regular expressions. |
Subroutines::ProhibitAmpersandSigils | 5 | Don't call functions with a leading ampersand sigil. |
Subroutines::ProhibitBuiltinHomonyms | 5 | Don't declare your own open function. |
Subroutines::ProhibitCallsToUndeclaredSubs | 5 | |
Subroutines::ProhibitCallsToUnexportedSubs | 5 | |
Subroutines::ProhibitExcessComplexity | 5 | Minimize complexity by factoring code into smaller subroutines. |
Subroutines::ProhibitExplicitReturnUndef | 5 | Return failure with bare return instead of return undef. |
Subroutines::ProhibitExportingUndeclaredSubs | 5 | |
Subroutines::ProhibitManyArgs | 5 | Too many arguments. |
Subroutines::ProhibitNestedSubs | 5 | sub never { sub correct {} }. |
Subroutines::ProhibitQualifiedSubDeclarations | 5 | |
Subroutines::ProhibitReturnSort | 5 | Behavior of sort is not defined if called in scalar context. |
Subroutines::ProhibitSubroutinePrototypes | 5 | Don't write sub my_function (@@) {}. |
Subroutines::ProhibitUnusedPrivateSubroutines | 5 | Prevent unused private subroutines. |
Subroutines::ProtectPrivateSubs | 5 | Prevent access to private subs in other packages. |
Subroutines::RequireArgUnpacking | 5 | Always unpack @_ first. |
Subroutines::RequireFinalReturn | 5 | End every path through a subroutine with an explicit return statement. |
TestingAndDebugging::ProhibitNoStrict | 5 | Prohibit various flavors of no strict. |
TestingAndDebugging::ProhibitNoWarnings | 5 | Prohibit various flavors of no warnings. |
TestingAndDebugging::ProhibitProlongedStrictureOverride | 5 | Don't turn off strict for large blocks of code. |
TestingAndDebugging::RequireTestLabels | 5 | Tests should all have labels. |
TestingAndDebugging::RequireUseStrict | 5 | Always use strict. |
TestingAndDebugging::RequireUseWarnings | 5 | Always use warnings. |
Tics::ProhibitLongLines | 5 | 80 x 40 for life! |
Tics::ProhibitManyArrows | 5 | (this => is => not => good) |
Tics::ProhibitUseBase | 5 | do not use base.pm |
TryTiny::ProhibitExitingSubroutine | 5 | Ban next/last/return in Try::Tiny blocks |
TryTiny::RequireCatch | 5 | Always include a "catch" block when using "try" |
ValuesAndExpressions::ConstantBeforeLt | 5 | disallow bareword before < |
ValuesAndExpressions::NotWithCompare | 5 | logical not used with compare |
ValuesAndExpressions::PreventSQLInjection | 5 | Prevent SQL injection in interpolated strings. |
ValuesAndExpressions::ProhibitArrayAssignAref | 5 | don't assign an anonymous arrayref to an array |
ValuesAndExpressions::ProhibitBarewordDoubleColon | 5 | don't use Foo:: style barewords |
ValuesAndExpressions::ProhibitCommaSeparatedStatements | 5 | Don't use the comma operator as a statement separator. |
ValuesAndExpressions::ProhibitComplexVersion | 5 | Prohibit version values from outside the module. |
ValuesAndExpressions::ProhibitConstantPragma | 5 | Don't < use constant FOO = 15 >>. |
ValuesAndExpressions::ProhibitDuplicateHashKeys | ||
ValuesAndExpressions::ProhibitEmptyCommas | 5 | disallow empty consecutive commas |
ValuesAndExpressions::ProhibitEmptyQuotes | 5 | Write q{} instead of ''. |
ValuesAndExpressions::ProhibitEscapedCharacters | 5 | Write "\N{DELETE}" instead of "\x7F", etc. |
ValuesAndExpressions::ProhibitFiletest_f | 5 | don't use the -f file test |
ValuesAndExpressions::ProhibitImplicitNewlines | 5 | Use concatenation or HEREDOCs instead of literal line breaks in strings. |
ValuesAndExpressions::ProhibitInterpolationOfLiterals | 5 | Always use single quotes for literal strings. |
ValuesAndExpressions::ProhibitLeadingZeros | 5 | Write oct(755) instead of 0755. |
ValuesAndExpressions::ProhibitLongChainsOfMethodCalls | 5 | Long chains of method calls indicate tightly coupled code. |
ValuesAndExpressions::ProhibitMagicNumbers | 5 | Don't use values that don't explain themselves. |
ValuesAndExpressions::ProhibitMismatchedOperators | 5 | Don't mix numeric operators with string operands, or vice-versa. |
ValuesAndExpressions::ProhibitMixedBooleanOperators | 5 | Write !$foo && $bar instead of not $foo && $bar or $baz. |
ValuesAndExpressions::ProhibitNoisyQuotes | 5 | Use q{} or qq{} instead of quotes for awkward-looking strings. |
ValuesAndExpressions::ProhibitNullStatements | 5 | disallow empty statements (stray semicolons) |
ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters | 5 | Don't use quotes (', ", `) as delimiters for the quote-like operators. |
ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator | 5 | Don't write print <<'__END__' . |
ValuesAndExpressions::ProhibitUnknownBackslash | 5 | don't use undefined backslash forms |
ValuesAndExpressions::ProhibitVersionStrings | 5 | Don't use strings like v1.4 or 1.4.5 when including other modules. |
ValuesAndExpressions::RequireConstantOnLeftSideOfEquality | 5 | Putting the constant value on the left side of an equality exposes typos. |
ValuesAndExpressions::RequireConstantVersion | 5 | Require $VERSION to be a constant rather than a computed value. |
ValuesAndExpressions::RequireInterpolationOfMetachars | 5 | Warns that you might have used single quotes when you really wanted double-quotes. |
ValuesAndExpressions::RequireNumberSeparators | 5 | Write 141_234_397.0145 instead of 141234397.0145 . |
ValuesAndExpressions::RequireNumericVersion | 5 | $VERSION a plain number |
ValuesAndExpressions::RequireQuotedHeredocTerminator | 5 | Write print <<'THE_END' or print <<"THE_END" . |
ValuesAndExpressions::RequireUpperCaseHeredocTerminator | 5 | Write <<'THE_END'; instead of <<'theEnd'; . |
ValuesAndExpressions::RestrictLongStrings | 5 | Stop mixing long strings with code. |
ValuesAndExpressions::UnexpandedSpecialLiteral | 5 | specials like __PACKAGE__ used literally |
Variables::ProhibitAugmentedAssignmentInDeclaration | 5 | Do not write my $foo .= 'bar'; . |
Variables::ProhibitConditionalDeclarations | 5 | Do not write my $foo = $bar if $baz; . |
Variables::ProhibitEvilVariables | 5 | Ban variables that aren't blessed by your shop. |
Variables::ProhibitLocalVars | 5 | Use my instead of local, except when you have to. |
Variables::ProhibitMatchVars | 5 | Avoid $`, $&, $' and their English equivalents. |
Variables::ProhibitPackageVars | 5 | Eliminate globals declared with our or use vars. |
Variables::ProhibitPerl4PackageNames | 5 | Use double colon (::) to separate package name components instead of single quotes ('). |
Variables::ProhibitPunctuationVars | 5 | Write $EVAL_ERROR instead of $@. |
Variables::ProhibitReusedNames | 5 | Do not reuse a variable name in a lexical scope |
Variables::ProhibitUnusedVariables | 5 | Don't ask for storage you don't need. |
Variables::ProhibitUnusedVarsStricter | 5 | Don't ask for storage you don't need. |
Variables::ProhibitUselessInitialization | 5 | prohibit superfluous initializations |
Variables::ProtectPrivateVars | 5 | Prevent access to private vars in other packages. |
Variables::RequireInitializationForLocalVars | 5 | Write local $foo = $bar; instead of just local $foo;. |
Variables::RequireLexicalLoopIterators | 5 | Write for my $element (@list) {...} instead of for $element (@list) {...}. |
Variables::RequireLocalizedPunctuationVars | 5 | Magic variables should be assigned as "local". |
Variables::RequireNegativeIndices | 5 | Negative array index should be used. |
Examples
Published on 2015-05-21