Perl::Critic::Pulp - some add-on perlcritic policies
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).
Perl::Critic
Roughly half are code related and half cosmetic. You can always enable or disable the ones you do or don't want. It's normal to pick and choose things reported. There's a lot of perlcritic policies both built-in and add-on and they range from helpful things catching problems through to the bizarre or restrictive, and in some cases mutually contradictory! Many are only intended as building blocks for enforcing a house style. If you try to pass everything then you'll give away big parts of the language, so if you're not turning off or customizing about half then you're either not trying or you're much too easily lead!
Check keyword arguments to __x, __nx, etc.
__x
__nx
Don't quote version requirement use Foo '1.5'
use Foo '1.5'
$VERSION a plain number for comparisons and checking.
$VERSION
Avoid problems with FOO < 123
FOO < 123
Avoid problems with ! $x == $y
! $x == $y
Don't use -f.
-f
Literal use of __PACKAGE__ etc.
__PACKAGE__
Perl version for hash style multi-constants.
Perl version for constants with leading underscore.
Gtk2 module version for its constants.
Perl version declared against features used.
Perl version declared against POD features used.
Prefer File::Spec->devnull over explicit /dev/null.
File::Spec->devnull
Put __END__ before POD, at end of file.
__END__
Locale::TextDomain imported but not used.
Locale::TextDomain
Don't import the whole of POSIX.
POSIX
Semicolon ; on the last statement of a subroutine or block.
;
Stray consecutive commas ,,
,,
Stray semicolons ;
Unknown \z etc escapes in strings.
\z
Double-colon barewords Foo::Bar::
Foo::Bar::
No #! interpreter line in .pm files.
#!
Put commas or some text in between adjacent L<> links.
L<>
Avoid C<> in NAME section, bad for man's "apropos" output.
Don't end paragraph with ".." (stray extra dot).
Verbatim paragraphs not expanding C<> etc markup.
C<>
Use L<> markup on URLs.
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.
Perl::Critic::Policy::...
man-completion.el
M-x man
ffap-perl-module.el
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:.
%
http://user42.tuxfamily.org/perl-critic-pulp/index.html
Copyright 2008, 2009, 2010, 2011 Kevin Ryde
Perl-Critic-Pulp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Perl-Critic-Pulp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Perl-Critic-Pulp. If not, see <http://www.gnu.org/licenses/>.
To install Perl::Critic::Pulp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::Critic::Pulp
CPAN shell
perl -MCPAN -e shell install Perl::Critic::Pulp
For more information on module installation, please visit the detailed CPAN module installation guide.