Perl::Critic::Pulp - some add-on perlcritic policies


Perl-Critic-Pulp documentation  | view source Contained in the Perl-Critic-Pulp distribution.

Index


NAME

Top

Perl::Critic::Pulp - some add-on perlcritic policies

DESCRIPTION

Top

This is a collection of add-on policies for Perl::Critic, summarized below. They're under a "pulp" theme plus other themes according to their purpose (see POLICY THEMES in Perl::Critic).

Bugs

Miscellanea::TextDomainPlaceholders

Check keyword arguments to __x, __nx, etc.

Modules::ProhibitUseQuotedVersion

Don't quote version requirement use Foo '1.5'

ValuesAndExpressions::RequireNumericVersion

$VERSION a plain number for comparisons and checking.

ValuesAndExpressions::ConstantBeforeLt

Avoid problems with FOO < 123

ValuesAndExpressions::NotWithCompare

Avoid problems with ! $x == $y

ValuesAndExpressions::ProhibitArrayAssignAref

Dubious @array=[1,2,3] array/arrayref assignment.

ValuesAndExpressions::ProhibitFiletest_f

Don't use -f.

ValuesAndExpressions::UnexpandedSpecialLiteral

Literal use of __PACKAGE__ etc.

Compatibility

Compatibility::ConstantPragmaHash

Perl version for hash style multi-constants.

Compatibility::ConstantLeadingUnderscore

Perl version for constants with leading underscore.

Compatibility::Gtk2Constants

Gtk2 module version for its constants.

Compatibility::PerlMinimumVersionAndWhy

Perl version declared against features used.

Compatibility::PodMinimumVersion

Perl version declared against POD features used.

Compatibility::ProhibitUnixDevNull

Prefer File::Spec->devnull over explicit /dev/null.

Efficiency

Documentation::RequireEndBeforeLastPod

Put __END__ before POD, at end of file.

Miscellanea::TextDomainUnused

Locale::TextDomain imported but not used.

Modules::ProhibitPOSIXimport

Don't import the whole of POSIX.

Cosmetic

CodeLayout::RequireTrailingCommaAtNewline
CodeLayout::RequireFinalSemicolon

Semicolon ; on the last statement of a subroutine or block.

ValuesAndExpressions::ProhibitEmptyCommas

Stray consecutive commas ,,

ValuesAndExpressions::ProhibitNullStatements

Stray semicolons ;

ValuesAndExpressions::ProhibitUnknownBackslash

Unknown \z etc escapes in strings.

ValuesAndExpressions::ProhibitBarewordDoubleColon

Double-colon barewords Foo::Bar::

Modules::ProhibitModuleShebang

No #! interpreter line in .pm files.

Documentation

Documentation::ProhibitUnbalancedParens

Unbalanced or mismatched ( ) parens, brackets and braces.

Documentation::ProhibitAdjacentLinks

Put commas or some text in between adjacent L<> links.

Documentation::ProhibitBadAproposMarkup

Avoid C<> in NAME section, bad for man's "apropos" output.

Documentation::ProhibitParagraphTwoDots

Don't end paragraph with ".." (stray extra dot).

Documentation::ProhibitVerbatimMarkup

Verbatim paragraphs not expanding C<> etc markup.

Documentation::RequireLinkedURLs

Use L<> markup on URLs.

Selecting

You can always enable or disable the policies you do or don't want (see CONFIGURATION in Perl::Critic). If you haven't already realized, there's a wide range of builtin and add-on perlcritic policies ranging from bug catching to the bizarre or deliberately restrictive. You're not meant to pass all of them and some may even be mutually contradictory.

The restrictive policies are meant as building blocks for a limited house style. ProhibitBarewordDoubleColon above is an example of this, something like ProhibitUnlessBlocks is another. They're usually a matter of personal preference (and non de gustibus disputandum), but following all gives away big parts of the language and ends up with very un-typical code.

Some policies are geared a bit towards beginners. ProhibitUnknownBackslash above or RequireInitializationForLocalVars are along those lines. If you know what you're doing there may be good backslashing the prohibition doesn't know, and local variable initializers make no sense for output variables like $! when you get to the level of using local to preserve such values.

In general the POD docs are supposed to explain the motivation so you can see if you want it or not, but if you're not turning off or drastically customizing about half of all policies then you're either not trying or you're much too easily lead!

OTHER NOTES

Top

In most of the perlcritic documentation, including the Pulp stuff here, policy names appear without the full Perl::Critic::Policy::... class part. In Emacs try man-completion.el to have M-x man automatically expand a suffix part at point, or ffap-perl-module.el to go to the source similarly.

    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 for the full policy name to copy or follow. Here's a good format you can put in your .perlcriticrc, including file:line:column: style Emacs will recognise.

    verbose=%f:%l:%c:\n %P\n %m\n

See Perl::Critic::Violation for all the % escapes. perlcritic.el has patterns for Emacs to match the builtin perlcritic formats, but it's easier to print file:line:column:.

SEE ALSO

Top

Perl::Critic

HOME PAGE

Top

http://user42.tuxfamily.org/perl-critic-pulp/index.html

COPYRIGHT

Top


Perl-Critic-Pulp documentation  | view source Contained in the Perl-Critic-Pulp distribution.