Usage:
perlcritic [-12345 | --brutal | --cruel | --harsh | --stern | --gentle]
[--severity number | name] [{-p | --profile} file | --noprofile]
[--top [ number ]] [--theme expression] [--include pattern]
[--exclude pattern] [{-s | --single-policy} pattern]
[--only | --noonly] [--profile-strictness {warn|fatal|quiet}]
[--force | --noforce] [--statistics] [--statistics-only]
[--count | -C] [--verbose {number | format}]
[--color | --nocolor] [--pager pager] [--quiet]
[--color-severity-highest color_specification]
[--color-severity-high color_specification]
[--color-severity-medium color_specification]
[--color-severity-low color_specification]
[--color-severity-lowest color_specification]
{FILE | DIRECTORY | STDIN}
perlcritic --profile-proto
perlcritic { --list | --list-themes | --doc pattern [...] }
perlcritic { --help | --options | --man | --version }
using Perl::Critic
http://perlcritic.com/ - online checker
http://search.cpan.org/dist/Perl-Critic/lib/Perl/Critic.pm
http://www.emacswiki.org/emacs/perlcritic.el
http://www.slideshare.net/joshua.mcadams/an-introduction-to-perl-critic
criticize.pl w:\<folder>\*.pl
or
criticize.pl w:\<folder>\*.pl >> report.log
(no screen output, everything goes to report.log)
#!/usr/local/bin/perl -w
# http://search.cpan.org/dist/Perl-Critic/lib/Perl/Critic.pm
#
# Michael Paulukonis
# August 2007
use strict;
use warnings;
use Perl::Critic;
while (my $file = shift) {
my $critic = Perl::Critic->new();
my @violations = $critic->critique($file);
print "\n".$file."\n";
my $count = $#violations + 1;
if ($count > 0) {
print @violations;
} else {
print "\tNo criticisms!\n";
}
}
# http://search.cpan.org/dist/Perl-Critic/lib/Perl/Critic.pm
#
# Michael Paulukonis
# August 2007
use strict;
use warnings;
use Perl::Critic;
while (my $file = shift) {
my $critic = Perl::Critic->new();
my @violations = $critic->critique($file);
print "\n".$file."\n";
my $count = $#violations + 1;
if ($count > 0) {
print @violations;
} else {
print "\tNo criticisms!\n";
}
}
See Also