Perl::Critic::Pulp3pm
Some add-on perlcritic policies
Overview
This is a collection of add-on policies for "Perl::Critic". They're under a "pulp" theme plus other themes according to their purpose (see "POLICY THEMES" in Perl::Critic).
Bugs
CodeLayout::ProhibitFatCommaNewline
|
Avoid newline before |
|---|---|
CodeLayout::ProhibitIfIfSameLine
|
Avoid |
Miscellanea::TextDomainPlaceholders
|
Check keyword arguments to |
Modules::ProhibitUseQuotedVersion
|
Don't quote a version requirement like |
ValuesAndExpressions::RequireNumericVersion
|
|
ValuesAndExpressions::ConstantBeforeLt
|
Avoid problems with |
ValuesAndExpressions::NotWithCompare
|
Avoid problems with |
ValuesAndExpressions::ProhibitArrayAssignAref
|
Dubious |
ValuesAndExpressions::ProhibitDuplicateHashKeys
|
Duplicate literal keys |
ValuesAndExpressions::ProhibitFiletest_f
|
Don't use |
ValuesAndExpressions::UnexpandedSpecialLiteral
|
|
Compatibility
Compatibility::ConstantPragmaHash
|
Version requirement for hash style multi-constants. |
|---|---|
Compatibility::ConstantLeadingUnderscore
|
Version requirement for constants with leading underscore. |
Compatibility::Gtk2Constants
|
Gtk2 module version requirement for some constants. |
Compatibility::PerlMinimumVersionAndWhy
|
Perl version declared against features used. |
Compatibility::PodMinimumVersion
|
Perl version declared against POD features used. |
Compatibility::ProhibitUnixDevNull
|
Prefer |
Efficiency
Documentation::RequireEndBeforeLastPod
|
Put |
|---|---|
Miscellanea::TextDomainUnused
|
|
Modules::ProhibitPOSIXimport
|
Don't import the whole of |
Cosmetic
CodeLayout::RequireTrailingCommaAtNewline
|
Comma "," at the end of list, if at a newline. |
|---|---|
CodeLayout::RequireFinalSemicolon
|
Semicolon |
ValuesAndExpressions::ProhibitEmptyCommas
|
Stray consecutive commas |
ValuesAndExpressions::ProhibitNullStatements
|
Stray semicolons |
ValuesAndExpressions::ProhibitUnknownBackslash
|
Unknown |
ValuesAndExpressions::ProhibitBarewordDoubleColon
|
Double-colon barewords |
Modules::ProhibitModuleShebang
|
No |
Documentation
Documentation::ProhibitUnbalancedParens
|
Unbalanced or mismatched ( ) parens, brackets and braces. |
|---|---|
Documentation::ProhibitAdjacentLinks
|
Put commas or some text between adjacent |
Documentation::ProhibitDuplicateHeadings
|
Don't duplicate |
Documentation::ProhibitDuplicateSeeAlso
|
Don't duplicate |
Documentation::ProhibitBadAproposMarkup
|
Avoid |
Documentation::RequireFilenameMarkup
|
Markup /foo filenames. |
Documentation::ProhibitLinkToSelf
|
Don't |
Documentation::ProhibitParagraphEndComma
|
Don't end paragraph with "," comma. |
Documentation::ProhibitParagraphTwoDots
|
Don't end paragraph with ".." (stray extra dot). |
Documentation::ProhibitVerbatimMarkup
|
Verbatim paragraphs not expanding |
Documentation::RequireFinalCut
|
Have a |
Documentation::RequireLinkedURLs
|
Use |
Selecting
You can always enable or disable the policies you do or don't want (see "CONFIGURATION" in Perl::Critic). You may have already realized that there's a wide range of builtin and add-on perlcritic policies ranging from buggy practice to deliberately restrictive or even quite bizarre. You're not meant to pass everything. Some policies may even be mutually contradictory.
The restrictive policies are meant as building blocks for a house style. For example "ProhibitBarewordDoubleColon" here, or something like "ProhibitUnlessBlocks". They're usually a matter of personal preference, and "non de gustibus disputandum" as they say in the classics. Trying to follow all such policies would give away big parts of the language and quite likely result in very un-typical code.
Some of the restrictive policies are geared towards beginners. "ProhibitUnknownBackslash" here or "RequireInitializationForLocalVars" are along those lines. There might for instance be good backslashing which the prohibition doesn't recognise, or local variable initializers make no sense for output variables like $!, once you get to the level of knowing to use "local" to preserve such globals.
In general the POD of each policy is supposed to explain the motivation so you can see whether you want it or not. If you're not turning off or drastically customizing at least half of all policies then you're either not trying or you're much too easily lead!
Other notes
In most of the perlcritic documentation, including the Pulp add-ons here, policy names appear without the full "Perl::Critic::Policy::..." class part. In Emacs try "man-completion.el" to make "M-x man" automatically expand a suffix part at point, or "ffap-perl-module.el" for the same to go to the source.
•
|
<http://user42.tuxfamily.org/man-completion/index.html> |
|---|---|
•
|
<http://user42.tuxfamily.org/ffap-perl-module/index.html> |
In perlcritic's output you can ask for %P to see the full policy package name to run "perldoc" or copy or follow etc. Here's a good output format you can put in your .perlcriticrc. The file:line:column: part is a style Emacs will recognise.
verbose=%f:%l:%c:\n %P\n %m\n
See Perl::Critic::Violation for all available "%" escapes. "perlcritic.el" which comes with perlcritic has regexp patterns for Emacs to recognise the builtin perlcritic formats, but it's easier to output "file:line:column:" in the first place.
Home page
<http://user42.tuxfamily.org/perl-critic-pulp/index.html>
Releases
4 releases since Debian 10 (Buster); the text changed 1 time.