Documentation
Things for Perl::Critic developers to do
Command-line interface to critique Perl source
Integrating perlcritic and Komodo
How to make new Perl::Critic::Policy modules.
Descriptions of the Policy modules included with Perl::Critic itself.
Dump Perl code as PPI structure
Modules
Critique Perl source code for best-practices.
The final derived Perl::Critic configuration, combined from any profile file and command-line parameters.
Caching wrapper around a PPI::Document.
A problem identified by Perl::Critic.
A collection of a set of problems found in the configuration and/or command-line options.
A problem with Perl::Critic configuration.
A problem with Perl::Critic configuration that doesn't involve an option.
A problem with an option in the Perl::Critic configuration.
A problem with Perl::Critic global configuration.
The configuration referred to a non-existent global option.
A problem with the value of a global parameter.
A problem with configuration of a policy.
The configuration referred to a non-existent parameter for a policy.
A problem with the value of a parameter for a policy.
A problem that should cause Perl::Critic to stop running.
A problem for which there is no specialized information.
A problem with the Perl::Critic implementation, i.e. a bug.
A bug in a policy.
A problem with input or output.
The code doesn't look like code.
The global configuration default values, combined with command-line values.
Base class for all Policy modules.
Use List::MoreUtils::any instead of grep in boolean context.
Map blocks should have a single statement.
Use 4-argument substr instead of writing substr($foo, 2, 6) = $bar.
Forbid $b before $a in sort blocks.
Use Time::HiRes instead of something like select(undef, undef, undef, .05).
Write eval { my $foo; bar($foo) } instead of eval "my $foo; bar($foo);".
Write split /-/, $string instead of split '-', $string.
Write < eval { $foo-can($name) } >> instead of UNIVERSAL::can($foo, $name).
Write < eval { $foo-isa($pkg) } >> instead of UNIVERSAL::isa($foo, $pkg).
Don't use grep in void contexts.
Don't use map in void contexts.
Write grep { $_ =~ /$pattern/ } @list instead of grep /$pattern/, @list.
Write map { $_ =~ /$pattern/ } @list instead of map /$pattern/, @list.
Use glob q{*} instead of <*>.
Sort blocks should have a single statement.
AUTOLOAD methods should be avoided.
Employ use base instead of @ISA.
Write bless {}, $class; instead of just bless {};.
Use spaces instead of tabs.
Write open $handle, $path instead of open($handle, $path).
Write qw(foo bar baz) instead of ('foo', 'bar', 'baz').
Don't use whitespace at the end of lines.
Use the same newline through the source.
Must run code through perltidy.
Put a comma at the end of every multi-line list declaration, including the last one.
Write for(0..20) instead of for($i=0; $i<=20; $i++).
Don't write long "if-elsif-elsif-elsif-elsif...else" chains.
Don't write deeply nested loops and conditionals.
Don't use labels that are the same as the special block names.
Don't modify $_ in list functions.
Don't use operators like not, !~, and le within until and unless.
Write if($condition){ do_something() } instead of do_something() if $condition.
Write if(! $condition) instead of unless($condition).
Don't write code after an unconditional die, exit, or next.
Write while(! $condition) instead of until($condition).
Check your spelling.
All POD should be after __END__.
Organize your POD into the customary sections.
Use functions from Carp instead of warn or die.
Discourage stuff like @files = `ls $directory`.
Write open my $fh, q{<}, $filename; instead of open FH, q{<}, $filename;.
Use "<>" or "<ARGV>" or a prompting module instead of "<STDIN>".
Use prompt() instead of -t.
Use local $/ = undef or File::Slurp instead of joined readline.
Never write select($fh).
Write < while( $line = < ){...} >> instead of < for(<){...} >>.
Write < open $fh, q{<}, $filename; > instead of < open $fh, "<$filename"; >.
Write print {$FH} $foo, $bar; instead of print $FH $foo, $bar;.
Close filehandles as soon as possible after opening them.
Write < my $error = close $fh; > instead of < close $fh; >.
Write < my $error = open $fh, $mode, $filename; > instead of < open $fh, $mode, $filename; >.
Return value of flagged function ignored.
Do not use format.
Do not use tie.
Put source-control keywords in every file.
Export symbols via @EXPORT_OK or %EXPORT_TAGS instead of @EXPORT.
Ban modules that aren't blessed by your shop.
Minimize complexity in code that is outside of subroutines.
Put packages (especially subclasses) in separate files.
Write require Module instead of require 'Module.pm'.
End each module with an explicitly 1; instead of some funky expression.
Always make the package explicit.
Package declaration must match filename.
use English must be passed a -no_match_vars argument.
Give every module a $VERSION number.
Don't use vague variable or subroutine names like 'last' or 'record'.
Write sub my_function{} instead of sub MyFunction{}.
Write $my_variable = 42 instead of $MyVariable = 42.
Write @{ $array_ref } instead of @$array_ref.
Capture variable used outside conditional.
Split long regexps into smaller qr// chunks.
Use named character classes instead of explicit character lists.
Use character classes for literal meta-characters instead of escapes.
Use eq or hash instead of fixed-pattern regexps.
Use [abc] instead of a.
Only use a capturing group if you plan to use the captured value.
Use only // or {} to delimit regexps.
Use { and } to delimit multi-line regexps.
Always use the /x modifier with regular expressions.
Always use the /m modifier with regular expressions.
Don't call functions with a leading ampersand sigil.
Don't declare your own open function.
Minimize complexity by factoring code into smaller subroutines.
Return failure with bare return instead of return undef.
sub never { sub correct {} }.
Too many arguments.
Don't write sub my_function (@@) {}.
Prevent access to private subs in other packages.
Always unpack @_ first.
End every path through a subroutine with an explicit return statement.
Prohibit various flavors of no strict.
Prohibit various flavors of no warnings.
Don't turn off strict for large blocks of code.
Tests should all have labels.
Always use strict.
Always use warnings.
Don't use the comma operator as a statement separator.
Don't < use constant $FOO = 15 >>.
Write q{} instead of ''.
Write "\N{DELETE}" instead of "\x7F", etc.
Use concatenation or HEREDOCs instead of literal line breaks in strings.
Always use single quotes for literal strings.
Write oct(755) instead of 0755.
Long chains of method calls indicate tightly coupled code.
Don't use values that don't explain themselves.
Don't mix numeric operators with string operands, or vice-versa.
Write !$foo && $bar instead of not $foo && $bar or $baz.
Use q{} or qq{} instead of quotes for awkward-looking strings.
Don't use quotes (', ", `) as delimiters for the quote-like operators.
Don't use strings like v1.4 or 1.4.5 when including other modules.
Warns that you might have used single quotes when you really wanted double-quotes.
Write 141_234_397.0145 instead of 141234397.0145 .
Write print <<'THE_END' or print <<"THE_END" .
Write <<'THE_END'; instead of <<'theEnd'; .
Do not write my $foo = $bar if $baz; .
Use my instead of local, except when you have to.
Avoid $`, $&, $' and their English equivalents.
Eliminate globals declared with our or use vars.
Use double colon (::) to separate package name components instead of single quotes (').
Write $EVAL_ERROR instead of $@.
Don't ask for storage you don't need.
Prevent access to private vars in other packages.
Write local $foo = $bar; instead of just local $foo;.
Write for my $element (@list) {...} instead of for $element (@list) {...}.
Magic variables should be assigned as "local".
Negative array index should be used.
Configuration data for a Policy.
Instantiates Policy objects.
Display minimal information about Policies.
Metadata about a parameter for a Policy.
Default type-specific actions for a parameter.
Actions appropriate for a boolean parameter.
Actions appropriate for an enumerated value.
Actions appropriate for an integer parameter.
Actions appropriate for a simple string parameter.
Actions appropriate for a parameter that is a list of strings.
Generate an initial Perl::Critic profile.
Compile stats on Perl::Critic violations.
Utility functions for testing new Policies.
Construct thematic sets of policies.
List the themes of the installed Policies.
The contents of the user's profile, often .perlcriticrc.
General utility subroutines and constants for Perl::Critic and derivative distributions.
Global constants.
Utilities for converting from one type of data to another.
Functions that calculate the McCabe score of source code.
Utility functions for dealing with POD.
Utility functions for dealing with PPI objects.
Utility functions for dealing with PPI regexp tokens.
A violation of a Policy found in some source code.