NAME
pcplist - List installed Perl::Critic policy modules
VERSION
This document describes version 0.008 of pcplist (from Perl distribution App-PerlCriticUtils), released on 2023-01-17.
SYNOPSIS
pcplist [--default-severity=uint] [--detail|-l|--no-detail|--nodetail] [--format=name|--json] [--max-default-severity=uint] [--min-default-severity=uint] [--(no)naked-res] [--page-result[=program]|--view-result[=program]] -- [query] ...
See examples in the "EXAMPLES" section.
OPTIONS
*
marks required options.
Main options
Filtering options
- --default-severity=s
-
(No description)
- --max-default-severity=s
-
(No description)
- --min-default-severity=s
-
(No description)
- --query-json=s
-
Filter by name (JSON-encoded).
See
--query
.Can also be specified as the 1st command-line argument and onwards.
- --query=s@
-
Filter by name.
Can also be specified as the 1st command-line argument and onwards.
Can be specified multiple times.
Output options
- --format=s
-
Choose output format, e.g. json, text.
Default value:
undef
Output can be displayed in multiple formats, and a suitable default format is chosen depending on the application and/or whether output destination is interactive terminal (i.e. whether output is piped). This option specifically chooses an output format.
- --json
-
Set output format to json.
- --naked-res
-
When outputing as JSON, strip result envelope.
Default value:
0
By default, when outputing as JSON, the full enveloped result is returned, e.g.:
[200,
"OK"
,[1,2,3],{
"func.extra"
=>4}]
The reason is so you can get the status (1st element), status message (2nd element) as well as result metadata/extra result (4th element) instead of just the result (3rd element). However, sometimes you want just the result, e.g. when you want to pipe the result for more post-processing. In this case you can use
--naked-res
so you just get:[1,2,3]
- --page-result
-
Filter output through a pager.
This option will pipe the output to a specified pager program. If pager program is not specified, a suitable default e.g.
less
is chosen. - --view-result
-
View output using a viewer.
This option will first save the output to a temporary file, then open a viewer program to view the temporary file. If a viewer program is not chosen, a suitable default, e.g. the browser, is chosen.
Other options
COMPLETION
This script has shell tab completion capability with support for several shells.
bash
To activate bash completion for this script, put:
complete -C pcplist pcplist
in your bash startup (e.g. ~/.bashrc). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately.
It is recommended, however, that you install modules using cpanm-shcompgen which can activate shell completion for scripts immediately.
tcsh
To activate tcsh completion for this script, put:
complete pcplist
'p/*/`pcplist`/'
in your tcsh startup (e.g. ~/.tcshrc). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately.
It is also recommended to install shcompgen (see above).
other shells
For fish and zsh, install shcompgen as described above.
EXAMPLES
List installed policies
% pcplist
BuiltinFunctions::GrepWithSimpleValue
BuiltinFunctions::ProhibitBooleanGrep
BuiltinFunctions::ProhibitComplexMappings
BuiltinFunctions::ProhibitLvalueSubstr
BuiltinFunctions::ProhibitReverseSortBlock
BuiltinFunctions::ProhibitShiftRef
BuiltinFunctions::ProhibitSleepViaSelect
BuiltinFunctions::ProhibitStringyEval
BuiltinFunctions::ProhibitStringySplit
BuiltinFunctions::ProhibitUniversalCan
BuiltinFunctions::ProhibitUniversalIsa
BuiltinFunctions::ProhibitUselessTopic
BuiltinFunctions::ProhibitVoidGrep
BuiltinFunctions::ProhibitVoidMap
BuiltinFunctions::RequireBlockGrep
BuiltinFunctions::RequireBlockMap
BuiltinFunctions::RequireGlobFunction
BuiltinFunctions::RequireSimpleSortBlock
ClassHierarchies::ProhibitAutoloading
ClassHierarchies::ProhibitExplicitISA
ClassHierarchies::ProhibitOneArgBless
CodeLayout::ProhibitHardTabs
CodeLayout::ProhibitParensWithBuiltins
CodeLayout::ProhibitQuotedWordLists
CodeLayout::ProhibitTrailingWhitespace
CodeLayout::RequireConsistentNewlines
CodeLayout::RequireTidyCode
CodeLayout::RequireTrailingCommas
ControlStructures::ProhibitCStyleForLoops
ControlStructures::ProhibitCascadingIfElse
ControlStructures::ProhibitDeepNests
ControlStructures::ProhibitLabelsWithSpecialBlockNames
ControlStructures::ProhibitMutatingListFunctions
ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions
ControlStructures::ProhibitPostfixControls
ControlStructures::ProhibitUnlessBlocks
ControlStructures::ProhibitUnreachableCode
ControlStructures::ProhibitUntilBlocks
ControlStructures::ProhibitYadaOperator
Documentation::PodSpelling
Documentation::RequirePackageMatchesPodName
Documentation::RequirePodAtEnd
Documentation::RequirePodSections
ErrorHandling::RequireCarping
ErrorHandling::RequireCheckingReturnValueOfEval
InputOutput::ProhibitBacktickOperators
InputOutput::ProhibitBarewordFileHandles
InputOutput::ProhibitExplicitStdin
InputOutput::ProhibitInteractiveTest
InputOutput::ProhibitJoinedReadline
InputOutput::ProhibitOneArgSelect
InputOutput::ProhibitReadlineInForLoop
InputOutput::ProhibitTwoArgOpen
InputOutput::RequireBracedFileHandleWithPrint
InputOutput::RequireBriefOpen
InputOutput::RequireCheckedClose
InputOutput::RequireCheckedOpen
InputOutput::RequireCheckedSyscalls
InputOutput::RequireEncodingWithUTF8Layer
Miscellanea::ProhibitFormats
Miscellanea::ProhibitTies
Miscellanea::ProhibitUnrestrictedNoCritic
Miscellanea::ProhibitUselessNoCritic
Modules::ProhibitAutomaticExportation
Modules::ProhibitConditionalUseStatements
Modules::ProhibitEvilModules
Modules::ProhibitExcessMainComplexity
Modules::ProhibitMultiplePackages
Modules::RequireBarewordIncludes
Modules::RequireEndWithOne
Modules::RequireExplicitPackage
Modules::RequireFilenameMatchesPackage
Modules::RequireNoMatchVarsWithUseEnglish
Modules::RequireVersionVar
NamingConventions::Capitalization
NamingConventions::ProhibitAmbiguousNames
Objects::ProhibitIndirectSyntax
References::ProhibitDoubleSigils
RegularExpressions::ProhibitCaptureWithoutTest
RegularExpressions::ProhibitComplexRegexes
RegularExpressions::ProhibitEnumeratedClasses
RegularExpressions::ProhibitEscapedMetacharacters
RegularExpressions::ProhibitFixedStringMatches
RegularExpressions::ProhibitSingleCharAlternation
RegularExpressions::ProhibitUnusedCapture
RegularExpressions::ProhibitUnusualDelimiters
RegularExpressions::ProhibitUselessTopic
RegularExpressions::RequireBracesForMultiline
RegularExpressions::RequireDotMatchAnything
RegularExpressions::RequireExtendedFormatting
RegularExpressions::RequireLineBoundaryMatching
Subroutines::ProhibitAmpersandSigils
Subroutines::ProhibitBuiltinHomonyms
Subroutines::ProhibitExcessComplexity
Subroutines::ProhibitExplicitReturnUndef
Subroutines::ProhibitManyArgs
Subroutines::ProhibitNestedSubs
Subroutines::ProhibitReturnSort
Subroutines::ProhibitSubroutinePrototypes
Subroutines::ProhibitUnusedPrivateSubroutines
Subroutines::ProtectPrivateSubs
Subroutines::RequireArgUnpacking
Subroutines::RequireFinalReturn
TestingAndDebugging::ProhibitNoStrict
TestingAndDebugging::ProhibitNoWarnings
TestingAndDebugging::ProhibitProlongedStrictureOverride
TestingAndDebugging::RequireTestLabels
TestingAndDebugging::RequireUseStrict
TestingAndDebugging::RequireUseWarnings
ValuesAndExpressions::ProhibitCommaSeparatedStatements
ValuesAndExpressions::ProhibitComplexVersion
ValuesAndExpressions::ProhibitConstantPragma
ValuesAndExpressions::ProhibitEmptyQuotes
ValuesAndExpressions::ProhibitEscapedCharacters
ValuesAndExpressions::ProhibitImplicitNewlines
ValuesAndExpressions::ProhibitInterpolationOfLiterals
ValuesAndExpressions::ProhibitLeadingZeros
ValuesAndExpressions::ProhibitLongChainsOfMethodCalls
ValuesAndExpressions::ProhibitMagicNumbers
ValuesAndExpressions::ProhibitMismatchedOperators
ValuesAndExpressions::ProhibitMixedBooleanOperators
ValuesAndExpressions::ProhibitNoisyQuotes
ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters
ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator
ValuesAndExpressions::ProhibitVersionStrings
ValuesAndExpressions::RequireConstantVersion
ValuesAndExpressions::RequireInterpolationOfMetachars
ValuesAndExpressions::RequireNumberSeparators
ValuesAndExpressions::RequireQuotedHeredocTerminator
ValuesAndExpressions::RequireUpperCaseHeredocTerminator
Variables::ProhibitAugmentedAssignmentInDeclaration
Variables::ProhibitConditionalDeclarations
Variables::ProhibitEvilVariables
Variables::ProhibitFatCommaInDeclaration
Variables::ProhibitLocalVars
Variables::ProhibitMatchVars
Variables::ProhibitPackageVars
Variables::ProhibitPerl4PackageNames
Variables::ProhibitPunctuationVars
Variables::ProhibitReusedNames
Variables::ProhibitUnusedVariables
Variables::ProtectPrivateVars
Variables::RequireInitializationForLocalVars
Variables::RequireLexicalLoopIterators
Variables::RequireLocalizedPunctuationVars
Variables::RequireNegativeIndices
List installed policies (show details)
% pcplist -l
+--------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------+-----------------------------------+------------------+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | abstract | applies_to | default_severity | default_themes | supported_parameters |
+--------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------+-----------------------------------+------------------+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| BuiltinFunctions::GrepWithSimpleValue | Warn
grep
with
simple value | PPI::Token::Word | 3 | core, bugs | |
| BuiltinFunctions::ProhibitBooleanGrep | Use C<List::MoreUtils::any> instead of C<
grep
> in boolean context. | PPI::Token::Word | 2 | core, pbp, performance, certrec | |
| BuiltinFunctions::ProhibitComplexMappings | Map blocks should have a single statement. | PPI::Token::Word | 3 | core, pbp, maintenance, complexity | max_statements |
| BuiltinFunctions::ProhibitLvalueSubstr | Use 4-argument C<
substr
> instead of writing C<
substr
(
$foo
, 2, 6) =
$bar
>. | PPI::Token::Word | 3 | core, maintenance, pbp | |
| BuiltinFunctions::ProhibitReverseSortBlock | Forbid
$b
before
$a
in
sort
blocks. | PPI::Token::Word | 1 | core, pbp, cosmetic | |
| BuiltinFunctions::ProhibitShiftRef | Prohibit C<\
shift
> in code | PPI::Token::Word | 3 | core, bugs, tests | |
| BuiltinFunctions::ProhibitSleepViaSelect | Use L<Time::HiRes|Time::HiRes> instead of something like C<
select
(
undef
,
undef
,
undef
, .05)>. | PPI::Token::Word | 5 | core, pbp, bugs | |
| BuiltinFunctions::ProhibitStringyEval | Write C<
eval
{
my
$foo
; bar(
$foo
) }> instead of C<
eval
"my $foo; bar($foo);"
>. | PPI::Token::Word | 5 | core, pbp, bugs, certrule | allow_includes |
| BuiltinFunctions::ProhibitStringySplit | Write C<
split
/-/,
$string
> instead of C<
split
'-'
,
$string
>. | PPI::Token::Word | 2 | core, pbp, cosmetic, certrule | |
| BuiltinFunctions::ProhibitUniversalCan | Write C<<
eval
{
$foo
->can(
$name
) } >> instead of C<UNIVERSAL::can(
$foo
,
$name
)>. | PPI::Token::Word | 3 | core, maintenance, certrule | |
| BuiltinFunctions::ProhibitUniversalIsa | Write C<<
eval
{
$foo
->isa(
$pkg
) } >> instead of C<UNIVERSAL::isa(
$foo
,
$pkg
)>. | PPI::Token::Word | 3 | core, maintenance, certrule | |
| BuiltinFunctions::ProhibitUselessTopic | Don't pass
$_
to built-in functions that assume it, or to most filetest operators. | PPI::Token::Word | 2 | core | |
| BuiltinFunctions::ProhibitVoidGrep | Don't
use
C<
grep
> in void contexts. | PPI::Token::Word | 3 | core, maintenance | |
| BuiltinFunctions::ProhibitVoidMap | Don't
use
C<
map
> in void contexts. | PPI::Token::Word | 3 | core, maintenance | |
| BuiltinFunctions::RequireBlockGrep | Write C<
grep
{ /
$pattern
/ }
@list
> instead of C<
grep
/
$pattern
/,
@list
>. | PPI::Token::Word | 4 | core, bugs, pbp | |
| BuiltinFunctions::RequireBlockMap | Write C<
map
{ /
$pattern
/ }
@list
> instead of C<
map
/
$pattern
/,
@list
>. | PPI::Token::Word | 4 | core, bugs, pbp | |
| BuiltinFunctions::RequireGlobFunction | Use C<
glob
q{*}
> instead of <*>. | PPI::Token::QuoteLike::Readline | 5 | core, pbp, bugs | |
| BuiltinFunctions::RequireSimpleSortBlock | Sort blocks should have a single statement. | PPI::Token::Word | 3 | core, pbp, maintenance, complexity | |
| ClassHierarchies::ProhibitAutoloading | AUTOLOAD methods should be avoided. | PPI::Statement::Sub | 3 | core, maintenance, pbp | |
| ClassHierarchies::ProhibitExplicitISA | Employ C<
use
base> instead of C<
@ISA
>. | PPI::Token::Symbol | 3 | core, maintenance, pbp, certrec | |
| ClassHierarchies::ProhibitOneArgBless | Write C<
bless
{},
$class
;> instead of just C<
bless
{};>. | PPI::Token::Word | 5 | core, pbp, bugs | |
| CodeLayout::ProhibitHardTabs | Use spaces instead of tabs. | PPI::Token | 3 | core, cosmetic, pbp | allow_leading_tabs |
| CodeLayout::ProhibitParensWithBuiltins | Write C<
open
$handle
,
$path
> instead of C<
open
(
$handle
,
$path
)>. | PPI::Token::Word | 1 | core, pbp, cosmetic | |
| CodeLayout::ProhibitQuotedWordLists | Write C<
qw(foo bar baz)
> instead of C<(
'foo'
,
'bar'
,
'baz'
)>. | PPI::Structure::List | 2 | core, cosmetic | min_elements, strict |
| CodeLayout::ProhibitTrailingWhitespace | Don't
use
whitespace at the end of lines. | PPI::Token::Whitespace | 1 | core, maintenance | |
| CodeLayout::RequireConsistentNewlines | Use the same newline through the source. | PPI::Document | 4 | core, bugs | |
| CodeLayout::RequireTidyCode | Must run code through L<perltidy|perltidy>. | PPI::Document | 1 | core, pbp, cosmetic | perltidyrc |
| CodeLayout::RequireTrailingCommas | Put a comma at the end of every multi-line list declaration, including the
last
one. | PPI::Structure::List | 1 | core, pbp, cosmetic | |
| ControlStructures::ProhibitCStyleForLoops | Write C<
for
(0..20)> instead of C<
for
(
$i
=0;
$i
<=20;
$i
++)>. | PPI::Structure::For | 2 | core, pbp, maintenance | |
| ControlStructures::ProhibitCascadingIfElse | Don't
write
long
"if-elsif-elsif-elsif-elsif...else"
chains. | PPI::Statement::Compound | 3 | core, pbp, maintenance, complexity | max_elsif |
| ControlStructures::ProhibitDeepNests | Don't
write
deeply nested loops and conditionals. | PPI::Statement::Compound | 3 | core, maintenance, complexity | max_nests |
| ControlStructures::ProhibitLabelsWithSpecialBlockNames | Don't
use
labels that are the same as the special block names. | PPI::Token::Label | 4 | core, bugs | |
| ControlStructures::ProhibitMutatingListFunctions | Don't modify C<
$_
> in list functions. | PPI::Token::Word | 5 | core, bugs, pbp, certrule | list_funcs, add_list_funcs |
| ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions | Don't
use
operators like C<not>, C<!~>, and C<le> within C<
until
> and C<
unless
>. | PPI::Token::Word | 3 | core, maintenance, pbp | |
| ControlStructures::ProhibitPostfixControls | Write C<
if
(
$condition
){ do_something() }> instead of C<do_something()
if
$condition
>. | PPI::Token::Word | 2 | core, pbp, cosmetic | allow, flowcontrol |
| ControlStructures::ProhibitUnlessBlocks | Write C<
if
(!
$condition
)> instead of C<
unless
(
$condition
)>. | PPI::Statement::Compound | 2 | core, pbp, cosmetic | |
| ControlStructures::ProhibitUnreachableCode | Don't
write
code
after
an unconditional C<
die
,
exit
, or
next
>. | PPI::Token::Word | 4 | core, bugs, certrec | |
| ControlStructures::ProhibitUntilBlocks | Write C<
while
(!
$condition
)> instead of C<
until
(
$condition
)>. | PPI::Statement | 2 | core, pbp, cosmetic | |
| ControlStructures::ProhibitYadaOperator | Never
use
C<...> in production code. | PPI::Token::Operator | 4 | core, pbp, maintenance | |
| Documentation::PodSpelling | Check your spelling. | PPI::Document | 1 | core, cosmetic, pbp | spell_command, stop_words, stop_words_file |
| Documentation::RequirePackageMatchesPodName | The C<=head1 NAME> section should match the
package
. | PPI::Document | 1 | core, cosmetic | |
| Documentation::RequirePodAtEnd | All POD should be
after
C<__END__>. | PPI::Document | 1 | core, cosmetic, pbp | |
| Documentation::RequirePodSections | Organize your POD into the customary sections. | PPI::Document | 2 | core, pbp, maintenance | lib_sections, script_sections, source, language |
| ErrorHandling::RequireCarping | Use functions from L<Carp|Carp> instead of C<
warn
> or C<
die
>. | PPI::Token::Word | 3 | core, pbp, maintenance, certrule | allow_messages_ending_with_newlines, allow_in_main_unless_in_subroutine |
| ErrorHandling::RequireCheckingReturnValueOfEval | You can't depend upon the value of C<$@>/C<
$EVAL_ERROR
> to
tell
whether an C<
eval
> failed. | PPI::Token::Word | 3 | core, bugs | |
| InputOutput::ProhibitBacktickOperators | Discourage stuff like C<
@files
= `ls
$directory
`>. | PPI::Token::QuoteLike::Command | 3 | core, maintenance | only_in_void_context |
| InputOutput::ProhibitBarewordFileHandles | Write C<
open
my
$fh
,
q{<}
,
$filename
;> instead of C<
open
FH,
q{<}
,
$filename
;>. | PPI::Token::Word | 5 | core, pbp, bugs, certrec | |
| InputOutput::ProhibitExplicitStdin | Use
"<>"
or
"<ARGV>"
or a prompting module instead of
"<STDIN>"
. | PPI::Token::QuoteLike::Readline | 4 | core, pbp, maintenance | |
| InputOutput::ProhibitInteractiveTest | Use prompt() instead of -t. | PPI::Token::Operator | 5 | core, pbp, bugs, certrule | |
| InputOutput::ProhibitJoinedReadline | Use C<
local
$/ =
undef
> or L<Path::Tiny|Path::Tiny> instead of joined
readline
. | PPI::Token::Word | 3 | core, pbp, performance | |
| InputOutput::ProhibitOneArgSelect | Never
write
C<
select
(
$fh
)>. | PPI::Token::Word | 4 | core, bugs, pbp, certrule | |
| InputOutput::ProhibitReadlineInForLoop | Write C<<
while
(
$line
= <> ){...} >> instead of C<<
for
(<>){...} >>. | PPI::Statement::Compound | 4 | core, bugs, pbp | |
| InputOutput::ProhibitTwoArgOpen | Write C<<
open
$fh
,
q{<}
,
$filename
; >> instead of C<<
open
$fh
,
"<$filename"
; >>. | PPI::Token::Word | 5 | core, pbp, bugs, security, certrule | |
| InputOutput::RequireBracedFileHandleWithPrint | Write C<
{
$FH
}
$foo
,
$bar
;> instead of C<
$FH
$foo
,
$bar
;>. | PPI::Token::Word | 1 | core, pbp, cosmetic | |
| InputOutput::RequireBriefOpen | Close filehandles as soon as possible
after
opening them. | PPI::Token::Word | 4 | core, pbp, maintenance | lines |
| InputOutput::RequireCheckedClose | Write C<<
my
$error
=
close
$fh
; >> instead of C<<
close
$fh
; >>. | PPI::Token::Word | 2 | core, maintenance, certrule | autodie_modules |
| InputOutput::RequireCheckedOpen | Write C<<
my
$error
=
open
$fh
,
$mode
,
$filename
; >> instead of C<<
open
$fh
,
$mode
,
$filename
; >>. | PPI::Token::Word | 3 | core, maintenance, certrule | autodie_modules |
| InputOutput::RequireCheckedSyscalls | Return value of flagged function ignored. | PPI::Token::Word | 1 | core, maintenance, certrule | functions, exclude_functions, autodie_modules |
| InputOutput::RequireEncodingWithUTF8Layer | Write C<<
open
$fh
,
q{<:encoding(UTF-8)}
,
$filename
; >> instead of C<<
open
$fh
,
q{<:utf8}
,
$filename
; >>. | PPI::Token::Word | 5 | core, bugs, security | |
| Miscellanea::ProhibitFormats | Do not
use
C<
format
>. | PPI::Token::Word | 3 | core, maintenance, pbp, certrule | |
| Miscellanea::ProhibitTies | Do not
use
C<
tie
>. | PPI::Token::Word | 2 | core, pbp, maintenance | |
| Miscellanea::ProhibitUnrestrictedNoCritic | Forbid a bare C<
## no critic> | PPI::Document | 3 | core, maintenance | |
| Miscellanea::ProhibitUselessNoCritic | Remove ineffective
"## no critic"
annotations. | PPI::Document | 2 | core, maintenance | |
| Modules::ProhibitAutomaticExportation | Export symbols via C<
@EXPORT_OK
> or C<
%EXPORT_TAGS
> instead of C<
@EXPORT
>. | PPI::Document | 4 | core, bugs | |
| Modules::ProhibitConditionalUseStatements | Avoid putting conditional logic
around
compile-
time
includes. | PPI::Statement::Include | 3 | core, bugs | |
| Modules::ProhibitEvilModules | Ban modules that aren't blessed by your shop. | PPI::Statement::Include | 5 | core, bugs, certrule | modules, modules_file |
| Modules::ProhibitExcessMainComplexity | Minimize complexity in code that is B<outside> of subroutines. | PPI::Document | 3 | core, complexity, maintenance | max_mccabe |
| Modules::ProhibitMultiplePackages | Put packages (especially subclasses) in separate files. | PPI::Document | 4 | core, bugs | |
| Modules::RequireBarewordIncludes | Write C<
require
Module> instead of C<
require
'Module.pm'
>. | PPI::Statement::Include | 5 | core, portability | |
| Modules::RequireEndWithOne | End
each
module
with
an explicitly C<1;> instead of some funky expression. | PPI::Document | 4 | core, bugs, pbp, certrule | |
| Modules::RequireExplicitPackage | Always make the C<
package
> explicit. | PPI::Document | 4 | core, bugs | exempt_scripts, allow_import_of |
| Modules::RequireFilenameMatchesPackage | Package declaration must match filename. | PPI::Document | 5 | core, bugs | |
| Modules::RequireNoMatchVarsWithUseEnglish | C<
use
English> must be passed a C<-no_match_vars> argument. | PPI::Statement::Include | 2 | core, performance | |
| Modules::RequireVersionVar | Give every module a C<
$VERSION
> number. | PPI::Document | 2 | core, pbp, readability | |
| NamingConventions::Capitalization | Distinguish different program components by case. | PPI::Token::Label | 1 | core, pbp, cosmetic | packages, package_exemptions, subroutines, subroutine_exemptions, local_lexical_variables, local_lexical_variable_exemptions, scoped_lexical_variables, scoped_lexical_variable_exemptions, file_lexical_variables, file_lexical_variable_exemptions, global_variables, global_variable_exemptions, constants, constant_exemptions, labels, label_exemptions |
| NamingConventions::ProhibitAmbiguousNames | Don
't use vague variable or subroutine names like '
last
' or '
record'. | PPI::Statement::Variable | 3 | core, pbp, maintenance | forbid |
| Objects::ProhibitIndirectSyntax | Prohibit indirect object call syntax. | PPI::Token::Word | 4 | core, pbp, maintenance, certrule | forbid |
| References::ProhibitDoubleSigils | Write C<@{
$array_ref
}> instead of C<
@$array_ref
>. | PPI::Token::Cast | 2 | core, pbp, cosmetic | |
| RegularExpressions::ProhibitCaptureWithoutTest | Capture variable used outside conditional. | PPI::Token::Magic | 3 | core, pbp, maintenance, certrule | exception_source |
| RegularExpressions::ProhibitComplexRegexes | Split long regexps into smaller C<
qr//
> chunks. | PPI::Token::QuoteLike::Regexp | 3 | core, pbp, maintenance | max_characters |
| RegularExpressions::ProhibitEnumeratedClasses | Use named character classes instead of explicit character lists. | PPI::Token::QuoteLike::Regexp | 1 | core, pbp, cosmetic, unicode | |
| RegularExpressions::ProhibitEscapedMetacharacters | Use character classes
for
literal meta-characters instead of escapes. | PPI::Token::QuoteLike::Regexp | 1 | core, pbp, cosmetic | |
| RegularExpressions::ProhibitFixedStringMatches | Use C<eq> or hash instead of fixed-pattern regexps. | PPI::Token::QuoteLike::Regexp | 2 | core, pbp, performance | |
| RegularExpressions::ProhibitSingleCharAlternation | Use C<[abc]> instead of C<a|b|c>. | PPI::Token::QuoteLike::Regexp | 1 | core, pbp, performance | |
| RegularExpressions::ProhibitUnusedCapture | Only
use
a capturing group
if
you plan to
use
the captured value. | PPI::Token::Regexp::Substitute | 3 | core, pbp, maintenance | |
| RegularExpressions::ProhibitUnusualDelimiters | Use only C<//> or C<{}> to delimit regexps. | PPI::Token::QuoteLike::Regexp | 1 | core, pbp, cosmetic | allow_all_brackets |
| RegularExpressions::ProhibitUselessTopic | Don't
use
$_
to match against regexes. | PPI::Token::Magic | 2 | core | |
| RegularExpressions::RequireBracesForMultiline | Use C<{> and C<}> to delimit multi-line regexps. | PPI::Token::QuoteLike::Regexp | 1 | core, pbp, cosmetic | allow_all_brackets |
| RegularExpressions::RequireDotMatchAnything | Always
use
the C</s> modifier
with
regular expressions. | PPI::Token::QuoteLike::Regexp | 2 | core, pbp, cosmetic | |
| RegularExpressions::RequireExtendedFormatting | Always
use
the C</x> modifier
with
regular expressions. | PPI::Token::QuoteLike::Regexp | 3 | core, pbp, maintenance | minimum_regex_length_to_complain_about, strict |
| RegularExpressions::RequireLineBoundaryMatching | Always
use
the C</m> modifier
with
regular expressions. | PPI::Token::QuoteLike::Regexp | 2 | core, pbp, cosmetic | |
| Subroutines::ProhibitAmpersandSigils | Don't call functions
with
a leading ampersand sigil. | PPI::Token::Symbol | 2 | core, pbp, maintenance | |
| Subroutines::ProhibitBuiltinHomonyms | Don't declare your own C<
open
> function. | PPI::Statement::Sub | 4 | core, bugs, pbp, certrule | |
| Subroutines::ProhibitExcessComplexity | Minimize complexity by factoring code into smaller subroutines. | PPI::Statement::Sub | 3 | core, complexity, maintenance | max_mccabe |
| Subroutines::ProhibitExplicitReturnUndef | Return failure
with
bare C<
return
> instead of C<
return
undef
>. | PPI::Token::Word | 5 | core, pbp, bugs, certrec | |
| Subroutines::ProhibitManyArgs | Too many arguments. | PPI::Statement::Sub | 3 | core, pbp, maintenance | max_arguments, skip_object |
| Subroutines::ProhibitNestedSubs | C<
sub
never {
sub
correct {} }>. | PPI::Statement::Sub | 5 | core, bugs | |
| Subroutines::ProhibitReturnSort | Behavior of C<
sort
> is not
defined
if
called in
scalar
context. | PPI::Token::Word | 5 | core, bugs, certrule | |
| Subroutines::ProhibitSubroutinePrototypes | Don't
write
C<
sub
my_function (@@) {}>. | PPI::Statement::Sub | 5 | core, pbp, bugs, certrec | |
| Subroutines::ProhibitUnusedPrivateSubroutines | Prevent unused private subroutines. | PPI::Statement::Sub | 3 | core, maintenance, certrec | private_name_regex, allow, skip_when_using, allow_name_regex |
| Subroutines::ProtectPrivateSubs | Prevent access to private subs in other packages. | PPI::Token::Word | 3 | core, maintenance, certrule | private_name_regex, allow |
| Subroutines::RequireArgUnpacking | Always
unpack
C<
@_
> first. | PPI::Statement::Sub | 4 | core, pbp, maintenance | short_subroutine_statements, allow_subscripts, allow_delegation_to |
| Subroutines::RequireFinalReturn | End every path through a subroutine
with
an explicit C<
return
> statement. | PPI::Statement::Sub | 4 | core, bugs, pbp, certrec | terminal_funcs, terminal_methods |
| TestingAndDebugging::ProhibitNoStrict | Prohibit various flavors of C<
no
strict>. | PPI::Statement::Include | 5 | core, pbp, bugs, certrec | allow |
| TestingAndDebugging::ProhibitNoWarnings | Prohibit various flavors of C<
no
warnings>. | PPI::Statement::Include | 4 | core, bugs, pbp, certrec | allow, allow_with_category_restriction |
| TestingAndDebugging::ProhibitProlongedStrictureOverride | Don't turn off strict
for
large blocks of code. | PPI::Statement::Include | 4 | core, pbp, bugs, certrec | statements |
| TestingAndDebugging::RequireTestLabels | Tests should all have labels. | PPI::Token::Word | 3 | core, maintenance, tests | modules |
| TestingAndDebugging::RequireUseStrict | Always C<
use
strict>. | PPI::Document | 5 | core, pbp, bugs, certrule, certrec | equivalent_modules |
| TestingAndDebugging::RequireUseWarnings | Always C<
use
warnings>. | PPI::Document | 4 | core, pbp, bugs, certrule | equivalent_modules |
| ValuesAndExpressions::ProhibitCommaSeparatedStatements | Don't
use
the comma operator as a statement separator. | PPI::Statement | 4 | core, bugs, pbp, certrule | allow_last_statement_to_be_comma_separated_in_map_and_grep |
| ValuesAndExpressions::ProhibitComplexVersion | Prohibit version
values
from outside the module. | PPI::Token::Symbol | 3 | core, maintenance | forbid_use_version |
| ValuesAndExpressions::ProhibitConstantPragma | Don't C<<
use
constant
FOO
=> 15 >>. | PPI::Statement::Include | 4 | core, bugs, pbp | |
| ValuesAndExpressions::ProhibitEmptyQuotes | Write C<
q{}
> instead of C<
''
>. | PPI::Token::Quote | 2 | core, pbp, cosmetic | |
| ValuesAndExpressions::ProhibitEscapedCharacters | Write C<
"\N{DELETE}"
> instead of C<
"\x7F"
>, etc. | PPI::Token::Quote::Interpolate | 2 | core, pbp, cosmetic | |
| ValuesAndExpressions::ProhibitImplicitNewlines | Use concatenation or HEREDOCs instead of literal line breaks in strings. | PPI::Token::Quote | 3 | core, pbp, cosmetic | |
| ValuesAndExpressions::ProhibitInterpolationOfLiterals | Always
use
single quotes
for
literal strings. | PPI::Token::Quote::Interpolate | 1 | core, pbp, cosmetic | allow, allow_if_string_contains_single_quote |
| ValuesAndExpressions::ProhibitLeadingZeros | Write C<
oct
(755)> instead of C<0755>. | PPI::Token::Number::Octal | 5 | core, pbp, bugs, certrec | strict |
| ValuesAndExpressions::ProhibitLongChainsOfMethodCalls | Long chains of method calls indicate tightly coupled code. | PPI::Statement | 2 | core, maintenance | max_chain_length |
| ValuesAndExpressions::ProhibitMagicNumbers | Don
't use values that don'
t explain themselves. | PPI::Token::Number | 2 | core, maintenance, certrec | allowed_values, allowed_types, allow_to_the_right_of_a_fat_comma, constant_creator_subroutines |
| ValuesAndExpressions::ProhibitMismatchedOperators | Don't mix numeric operators
with
string operands, or vice-versa. | PPI::Token::Operator | 3 | core, bugs, certrule | |
| ValuesAndExpressions::ProhibitMixedBooleanOperators | Write C< !
$foo
&&
$bar
||
$baz
> instead of C< not
$foo
&&
$bar
or
$baz
>. | PPI::Statement | 4 | core, bugs, pbp, certrec | |
| ValuesAndExpressions::ProhibitNoisyQuotes | Use C<
q{}
> or C<
qq{}
> instead of quotes
for
awkward-looking strings. | PPI::Token::Quote::Single | 2 | core, pbp, cosmetic | |
| ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters | Don
't use quotes (C<'
>, C<">, C<`>) as delimiters
for
the quote-like operators. | PPI::Token::Regexp::Transliterate | 3 | core, maintenance | single_quote_allowed_operators, double_quote_allowed_operators, back_quote_allowed_operators |
| ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator | Don
't write C< print <<'
__END__' >. | PPI::Token::HereDoc | 3 | core, maintenance | |
| ValuesAndExpressions::ProhibitVersionStrings | Don't
use
strings like C<v1.4> or C<1.4.5>
when
including other modules. | PPI::Statement::Include | 3 | core, pbp, maintenance | |
| ValuesAndExpressions::RequireConstantVersion | Require
$VERSION
to be a constant rather than a computed value. | PPI::Token::Symbol | 2 | core, maintenance | allow_version_without_use_on_same_line |
| ValuesAndExpressions::RequireInterpolationOfMetachars | Warns that you might have used single quotes
when
you really wanted double-quotes. | PPI::Token::Quote::Literal | 1 | core, pbp, cosmetic | rcs_keywords |
| ValuesAndExpressions::RequireNumberSeparators | Write C< 141_234_397.0145 > instead of C< 141234397.0145 >. | PPI::Token::Number | 2 | core, pbp, cosmetic | min_value |
| ValuesAndExpressions::RequireQuotedHeredocTerminator | Write C<
<<
'THE_END'
> or C<
<<
"THE_END"
>. | PPI::Token::HereDoc | 3 | core, pbp, maintenance | |
| ValuesAndExpressions::RequireUpperCaseHeredocTerminator | Write C< <<
'THE_END'
; > instead of C< <<
'theEnd'
; >. | PPI::Token::HereDoc | 2 | core, pbp, cosmetic | |
| Variables::ProhibitAugmentedAssignmentInDeclaration | Do not
write
C<
my
$foo
.=
'bar'
; >. | PPI::Statement::Variable | 4 | core, bugs | |
| Variables::ProhibitConditionalDeclarations | Do not
write
C<
my
$foo
=
$bar
if
$baz
; >. | PPI::Statement::Variable | 5 | core, bugs | |
| Variables::ProhibitEvilVariables | Ban variables that aren't blessed by your shop. | PPI::Token::Symbol | 5 | core, bugs | variables, variables_file |
| Variables::ProhibitFatCommaInDeclaration | Prohibit fat comma in declaration | PPI::Statement::Variable | 4 | core, bugs | |
| Variables::ProhibitLocalVars | Use C<
my
> instead of C<
local
>, except
when
you have to. | PPI::Statement::Variable | 2 | core, pbp, maintenance | |
| Variables::ProhibitMatchVars | Avoid C<$`>, C<$&>, C<$'> and their English equivalents. | PPI::Statement::Include | 4 | core, performance, pbp | |
| Variables::ProhibitPackageVars | Eliminate globals declared
with
C<
our
> or C<
use
vars>. | PPI::Statement::Include | 3 | core, pbp, maintenance | packages, add_packages |
| Variables::ProhibitPerl4PackageNames | Use double colon (::) to separate
package
name components instead of single quotes ('). | PPI::Token::Symbol | 2 | core, maintenance, certrec | |
| Variables::ProhibitPunctuationVars | Write C<
$EVAL_ERROR
> instead of C<$@>. | PPI::Token::HereDoc | 2 | core, pbp, cosmetic | allow, string_mode |
| Variables::ProhibitReusedNames | Do not reuse a variable name in a lexical scope | PPI::Statement::Variable | 3 | core, bugs | allow |
| Variables::ProhibitUnusedVariables | Don
't ask for storage you don'
t need. | PPI::Document | 3 | core, maintenance, certrec | |
| Variables::ProtectPrivateVars | Prevent access to private vars in other packages. | PPI::Token::Symbol | 3 | core, maintenance, certrule | |
| Variables::RequireInitializationForLocalVars | Write C<
local
$foo
=
$bar
;> instead of just C<
local
$foo
;>. | PPI::Statement::Variable | 3 | core, pbp, bugs, certrec | |
| Variables::RequireLexicalLoopIterators | Write C<
for
my
$element
(
@list
) {...}> instead of C<
for
$element
(
@list
) {...}>. | PPI::Statement::Compound | 5 | core, pbp, bugs, certrec | |
| Variables::RequireLocalizedPunctuationVars | Magic variables should be assigned as
"local"
. | PPI::Token::Operator | 4 | core, pbp, bugs, certrec | allow |
| Variables::RequireNegativeIndices | Negative array
index
should be used. | PPI::Structure::Subscript | 4 | core, maintenance, pbp | |
+--------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------+-----------------------------------+------------------+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
What's that policy that prohibits returning undef explicitly?
% pcplist
undef
BuiltinFunctions::ProhibitSleepViaSelect
InputOutput::ProhibitJoinedReadline
Subroutines::ProhibitExplicitReturnUndef
What's that policy that requires using strict?
% pcplist req strict
TestingAndDebugging::RequireUseStrict
List policies which have default severity of 5
% pcplist
'--default-severity=5'
-l
+--------------------------------------------------+------------------------------------------------------------------------------------------------------------+---------------------------------+------------------+-------------------------------------+----------------------------+
| name | abstract | applies_to | default_severity | default_themes | supported_parameters |
+--------------------------------------------------+------------------------------------------------------------------------------------------------------------+---------------------------------+------------------+-------------------------------------+----------------------------+
| BuiltinFunctions::ProhibitSleepViaSelect | Use L<Time::HiRes|Time::HiRes> instead of something like C<
select
(
undef
,
undef
,
undef
, .05)>. | PPI::Token::Word | 5 | core, pbp, bugs | |
| BuiltinFunctions::ProhibitStringyEval | Write C<
eval
{
my
$foo
; bar(
$foo
) }> instead of C<
eval
"my $foo; bar($foo);"
>. | PPI::Token::Word | 5 | core, pbp, bugs, certrule | allow_includes |
| BuiltinFunctions::RequireGlobFunction | Use C<
glob
q{*}
> instead of <*>. | PPI::Token::QuoteLike::Readline | 5 | core, pbp, bugs | |
| ClassHierarchies::ProhibitOneArgBless | Write C<
bless
{},
$class
;> instead of just C<
bless
{};>. | PPI::Token::Word | 5 | core, pbp, bugs | |
| ControlStructures::ProhibitMutatingListFunctions | Don't modify C<
$_
> in list functions. | PPI::Token::Word | 5 | core, bugs, pbp, certrule | list_funcs, add_list_funcs |
| InputOutput::ProhibitBarewordFileHandles | Write C<
open
my
$fh
,
q{<}
,
$filename
;> instead of C<
open
FH,
q{<}
,
$filename
;>. | PPI::Token::Word | 5 | core, pbp, bugs, certrec | |
| InputOutput::ProhibitInteractiveTest | Use prompt() instead of -t. | PPI::Token::Operator | 5 | core, pbp, bugs, certrule | |
| InputOutput::ProhibitTwoArgOpen | Write C<<
open
$fh
,
q{<}
,
$filename
; >> instead of C<<
open
$fh
,
"<$filename"
; >>. | PPI::Token::Word | 5 | core, pbp, bugs, security, certrule | |
| InputOutput::RequireEncodingWithUTF8Layer | Write C<<
open
$fh
,
q{<:encoding(UTF-8)}
,
$filename
; >> instead of C<<
open
$fh
,
q{<:utf8}
,
$filename
; >>. | PPI::Token::Word | 5 | core, bugs, security | |
| Modules::ProhibitEvilModules | Ban modules that aren't blessed by your shop. | PPI::Statement::Include | 5 | core, bugs, certrule | modules, modules_file |
| Modules::RequireBarewordIncludes | Write C<
require
Module> instead of C<
require
'Module.pm'
>. | PPI::Statement::Include | 5 | core, portability | |
| Modules::RequireFilenameMatchesPackage | Package declaration must match filename. | PPI::Document | 5 | core, bugs | |
| Subroutines::ProhibitExplicitReturnUndef | Return failure
with
bare C<
return
> instead of C<
return
undef
>. | PPI::Token::Word | 5 | core, pbp, bugs, certrec | |
| Subroutines::ProhibitNestedSubs | C<
sub
never {
sub
correct {} }>. | PPI::Statement::Sub | 5 | core, bugs | |
| Subroutines::ProhibitReturnSort | Behavior of C<
sort
> is not
defined
if
called in
scalar
context. | PPI::Token::Word | 5 | core, bugs, certrule | |
| Subroutines::ProhibitSubroutinePrototypes | Don't
write
C<
sub
my_function (@@) {}>. | PPI::Statement::Sub | 5 | core, pbp, bugs, certrec | |
| TestingAndDebugging::ProhibitNoStrict | Prohibit various flavors of C<
no
strict>. | PPI::Statement::Include | 5 | core, pbp, bugs, certrec | allow |
| TestingAndDebugging::RequireUseStrict | Always C<
use
strict>. | PPI::Document | 5 | core, pbp, bugs, certrule, certrec | equivalent_modules |
| ValuesAndExpressions::ProhibitLeadingZeros | Write C<
oct
(755)> instead of C<0755>. | PPI::Token::Number::Octal | 5 | core, pbp, bugs, certrec | strict |
| Variables::ProhibitConditionalDeclarations | Do not
write
C<
my
$foo
=
$bar
if
$baz
; >. | PPI::Statement::Variable | 5 | core, bugs | |
| Variables::ProhibitEvilVariables | Ban variables that aren't blessed by your shop. | PPI::Token::Symbol | 5 | core, bugs | variables, variables_file |
| Variables::RequireLexicalLoopIterators | Write C<
for
my
$element
(
@list
) {...}> instead of C<
for
$element
(
@list
) {...}>. | PPI::Statement::Compound | 5 | core, pbp, bugs, certrec | |
+--------------------------------------------------+------------------------------------------------------------------------------------------------------------+---------------------------------+------------------+-------------------------------------+----------------------------+
List policies which have default severity between 4 and 5
% pcplist
'--min-default-severity=4'
'--max-default-severity=5'
-l
+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------+---------------------------------+------------------+-------------------------------------+--------------------------------------------------------------------+
| name | abstract | applies_to | default_severity | default_themes | supported_parameters |
+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------+---------------------------------+------------------+-------------------------------------+--------------------------------------------------------------------+
| BuiltinFunctions::ProhibitSleepViaSelect | Use L<Time::HiRes|Time::HiRes> instead of something like C<
select
(
undef
,
undef
,
undef
, .05)>. | PPI::Token::Word | 5 | core, pbp, bugs | |
| BuiltinFunctions::ProhibitStringyEval | Write C<
eval
{
my
$foo
; bar(
$foo
) }> instead of C<
eval
"my $foo; bar($foo);"
>. | PPI::Token::Word | 5 | core, pbp, bugs, certrule | allow_includes |
| BuiltinFunctions::RequireBlockGrep | Write C<
grep
{ /
$pattern
/ }
@list
> instead of C<
grep
/
$pattern
/,
@list
>. | PPI::Token::Word | 4 | core, bugs, pbp | |
| BuiltinFunctions::RequireBlockMap | Write C<
map
{ /
$pattern
/ }
@list
> instead of C<
map
/
$pattern
/,
@list
>. | PPI::Token::Word | 4 | core, bugs, pbp | |
| BuiltinFunctions::RequireGlobFunction | Use C<
glob
q{*}
> instead of <*>. | PPI::Token::QuoteLike::Readline | 5 | core, pbp, bugs | |
| ClassHierarchies::ProhibitOneArgBless | Write C<
bless
{},
$class
;> instead of just C<
bless
{};>. | PPI::Token::Word | 5 | core, pbp, bugs | |
| CodeLayout::RequireConsistentNewlines | Use the same newline through the source. | PPI::Document | 4 | core, bugs | |
| ControlStructures::ProhibitLabelsWithSpecialBlockNames | Don't
use
labels that are the same as the special block names. | PPI::Token::Label | 4 | core, bugs | |
| ControlStructures::ProhibitMutatingListFunctions | Don't modify C<
$_
> in list functions. | PPI::Token::Word | 5 | core, bugs, pbp, certrule | list_funcs, add_list_funcs |
| ControlStructures::ProhibitUnreachableCode | Don't
write
code
after
an unconditional C<
die
,
exit
, or
next
>. | PPI::Token::Word | 4 | core, bugs, certrec | |
| ControlStructures::ProhibitYadaOperator | Never
use
C<...> in production code. | PPI::Token::Operator | 4 | core, pbp, maintenance | |
| InputOutput::ProhibitBarewordFileHandles | Write C<
open
my
$fh
,
q{<}
,
$filename
;> instead of C<
open
FH,
q{<}
,
$filename
;>. | PPI::Token::Word | 5 | core, pbp, bugs, certrec | |
| InputOutput::ProhibitExplicitStdin | Use
"<>"
or
"<ARGV>"
or a prompting module instead of
"<STDIN>"
. | PPI::Token::QuoteLike::Readline | 4 | core, pbp, maintenance | |
| InputOutput::ProhibitInteractiveTest | Use prompt() instead of -t. | PPI::Token::Operator | 5 | core, pbp, bugs, certrule | |
| InputOutput::ProhibitOneArgSelect | Never
write
C<
select
(
$fh
)>. | PPI::Token::Word | 4 | core, bugs, pbp, certrule | |
| InputOutput::ProhibitReadlineInForLoop | Write C<<
while
(
$line
= <> ){...} >> instead of C<<
for
(<>){...} >>. | PPI::Statement::Compound | 4 | core, bugs, pbp | |
| InputOutput::ProhibitTwoArgOpen | Write C<<
open
$fh
,
q{<}
,
$filename
; >> instead of C<<
open
$fh
,
"<$filename"
; >>. | PPI::Token::Word | 5 | core, pbp, bugs, security, certrule | |
| InputOutput::RequireBriefOpen | Close filehandles as soon as possible
after
opening them. | PPI::Token::Word | 4 | core, pbp, maintenance | lines |
| InputOutput::RequireEncodingWithUTF8Layer | Write C<<
open
$fh
,
q{<:encoding(UTF-8)}
,
$filename
; >> instead of C<<
open
$fh
,
q{<:utf8}
,
$filename
; >>. | PPI::Token::Word | 5 | core, bugs, security | |
| Modules::ProhibitAutomaticExportation | Export symbols via C<
@EXPORT_OK
> or C<
%EXPORT_TAGS
> instead of C<
@EXPORT
>. | PPI::Document | 4 | core, bugs | |
| Modules::ProhibitEvilModules | Ban modules that aren't blessed by your shop. | PPI::Statement::Include | 5 | core, bugs, certrule | modules, modules_file |
| Modules::ProhibitMultiplePackages | Put packages (especially subclasses) in separate files. | PPI::Document | 4 | core, bugs | |
| Modules::RequireBarewordIncludes | Write C<
require
Module> instead of C<
require
'Module.pm'
>. | PPI::Statement::Include | 5 | core, portability | |
| Modules::RequireEndWithOne | End
each
module
with
an explicitly C<1;> instead of some funky expression. | PPI::Document | 4 | core, bugs, pbp, certrule | |
| Modules::RequireExplicitPackage | Always make the C<
package
> explicit. | PPI::Document | 4 | core, bugs | exempt_scripts, allow_import_of |
| Modules::RequireFilenameMatchesPackage | Package declaration must match filename. | PPI::Document | 5 | core, bugs | |
| Objects::ProhibitIndirectSyntax | Prohibit indirect object call syntax. | PPI::Token::Word | 4 | core, pbp, maintenance, certrule | forbid |
| Subroutines::ProhibitBuiltinHomonyms | Don't declare your own C<
open
> function. | PPI::Statement::Sub | 4 | core, bugs, pbp, certrule | |
| Subroutines::ProhibitExplicitReturnUndef | Return failure
with
bare C<
return
> instead of C<
return
undef
>. | PPI::Token::Word | 5 | core, pbp, bugs, certrec | |
| Subroutines::ProhibitNestedSubs | C<
sub
never {
sub
correct {} }>. | PPI::Statement::Sub | 5 | core, bugs | |
| Subroutines::ProhibitReturnSort | Behavior of C<
sort
> is not
defined
if
called in
scalar
context. | PPI::Token::Word | 5 | core, bugs, certrule | |
| Subroutines::ProhibitSubroutinePrototypes | Don't
write
C<
sub
my_function (@@) {}>. | PPI::Statement::Sub | 5 | core, pbp, bugs, certrec | |
| Subroutines::RequireArgUnpacking | Always
unpack
C<
@_
> first. | PPI::Statement::Sub | 4 | core, pbp, maintenance | short_subroutine_statements, allow_subscripts, allow_delegation_to |
| Subroutines::RequireFinalReturn | End every path through a subroutine
with
an explicit C<
return
> statement. | PPI::Statement::Sub | 4 | core, bugs, pbp, certrec | terminal_funcs, terminal_methods |
| TestingAndDebugging::ProhibitNoStrict | Prohibit various flavors of C<
no
strict>. | PPI::Statement::Include | 5 | core, pbp, bugs, certrec | allow |
| TestingAndDebugging::ProhibitNoWarnings | Prohibit various flavors of C<
no
warnings>. | PPI::Statement::Include | 4 | core, bugs, pbp, certrec | allow, allow_with_category_restriction |
| TestingAndDebugging::ProhibitProlongedStrictureOverride | Don't turn off strict
for
large blocks of code. | PPI::Statement::Include | 4 | core, pbp, bugs, certrec | statements |
| TestingAndDebugging::RequireUseStrict | Always C<
use
strict>. | PPI::Document | 5 | core, pbp, bugs, certrule, certrec | equivalent_modules |
| TestingAndDebugging::RequireUseWarnings | Always C<
use
warnings>. | PPI::Document | 4 | core, pbp, bugs, certrule | equivalent_modules |
| ValuesAndExpressions::ProhibitCommaSeparatedStatements | Don't
use
the comma operator as a statement separator. | PPI::Statement | 4 | core, bugs, pbp, certrule | allow_last_statement_to_be_comma_separated_in_map_and_grep |
| ValuesAndExpressions::ProhibitConstantPragma | Don't C<<
use
constant
FOO
=> 15 >>. | PPI::Statement::Include | 4 | core, bugs, pbp | |
| ValuesAndExpressions::ProhibitLeadingZeros | Write C<
oct
(755)> instead of C<0755>. | PPI::Token::Number::Octal | 5 | core, pbp, bugs, certrec | strict |
| ValuesAndExpressions::ProhibitMixedBooleanOperators | Write C< !
$foo
&&
$bar
||
$baz
> instead of C< not
$foo
&&
$bar
or
$baz
>. | PPI::Statement | 4 | core, bugs, pbp, certrec | |
| Variables::ProhibitAugmentedAssignmentInDeclaration | Do not
write
C<
my
$foo
.=
'bar'
; >. | PPI::Statement::Variable | 4 | core, bugs | |
| Variables::ProhibitConditionalDeclarations | Do not
write
C<
my
$foo
=
$bar
if
$baz
; >. | PPI::Statement::Variable | 5 | core, bugs | |
| Variables::ProhibitEvilVariables | Ban variables that aren't blessed by your shop. | PPI::Token::Symbol | 5 | core, bugs | variables, variables_file |
| Variables::ProhibitFatCommaInDeclaration | Prohibit fat comma in declaration | PPI::Statement::Variable | 4 | core, bugs | |
| Variables::ProhibitMatchVars | Avoid C<$`>, C<$&>, C<$'> and their English equivalents. | PPI::Statement::Include | 4 | core, performance, pbp | |
| Variables::RequireLexicalLoopIterators | Write C<
for
my
$element
(
@list
) {...}> instead of C<
for
$element
(
@list
) {...}>. | PPI::Statement::Compound | 5 | core, pbp, bugs, certrec | |
| Variables::RequireLocalizedPunctuationVars | Magic variables should be assigned as
"local"
. | PPI::Token::Operator | 4 | core, pbp, bugs, certrec | allow |
| Variables::RequireNegativeIndices | Negative array
index
should be used. | PPI::Structure::Subscript | 4 | core, maintenance, pbp | |
+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------+---------------------------------+------------------+-------------------------------------+--------------------------------------------------------------------+
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-PerlCriticUtils.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-PerlCriticUtils.
AUTHOR
perlancar <perlancar@cpan.org>
CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on GitHub.
Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.
COPYRIGHT AND LICENSE
This software is copyright (c) 2023, 2022, 2021, 2018, 2017 by perlancar <perlancar@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-PerlCriticUtils
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.