Documentation

Things for Perl::Critic developers to do
Command-line interface to critique Perl source.
Hints for working on the Perl::Critic core.
How to make new Perl::Critic::Policy modules.
Descriptions of the Policy modules included with Perl::Critic itself.

Modules

Critique Perl source code for best-practices.
A "## no critic" annotation in a document.
Guts of perlcritic.
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.
The configuration referred to a non-existent policy.
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 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.
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).
Write grep { $_ =~ /$pattern/ } @list instead of grep /$pattern/, @list.
Write map { $_ =~ /$pattern/ } @list instead of map /$pattern/, @list.
Sort blocks should have a single statement.
Write bless {}, $class; instead of just bless {};.
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 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).
The =head1 NAME section should match the package.
All POD should be after __END__.
Provide text to display with your pod links.
Organize your POD into the customary sections.
Use functions from Carp instead of warn or die.
You can't depend upon the value of $@/$EVAL_ERROR to tell whether an eval failed.
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 local $/ = undef or File::Slurp instead of joined readline.
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.
Write < open $fh, q{<:encoding(UTF-8)}, $filename; > instead of < open $fh, q{{<:utf8}, $filename; >.
Remove ineffective "## no critic" annotations.
Put source-control keywords in every file.
Export symbols via @EXPORT_OK or %EXPORT_TAGS instead of @EXPORT.
Avoid putting conditional logic around compile-time includes.
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.
Distinguish different program components by case.
Don't use vague variable or subroutine names like 'last' or 'record'.
Prohibit indirect object call syntax.
Write @{ $array_ref } instead of @$array_ref.
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.
Only use a capturing group if you plan to use the captured value.
Use { and } to delimit multi-line regexps.
Always use the /s modifier with regular expressions.
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.
Behavior of sort is not defined if called in scalar context.
Prevent access to private subs in other packages.
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 use the comma operator as a statement separator.
Prohibit version values from outside the module.
Use concatenation or HEREDOCs instead of literal line breaks in strings.
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.
Require $VERSION to be a constant rather than a computed value.
Warns that you might have used single quotes when you really wanted double-quotes.
Write 141_234_397.0145 instead of 141234397.0145 .
Ban variables that aren't blessed by your shop.
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 (').
Do not reuse a variable name in a lexical scope
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.
Pod::Parser subclass to find all interior sequences.
Utility functions for dealing with PPI objects.
Utility functions for dealing with Perl language issues.
A violation of a Policy found in some source code.
A framework for testing your custom Policies