Should be possible to do in a test file, untested for irony:
use Test::More;
ues Perl::Critic;
my $policy = Perl::Critic->import(
-verbose => 8,
-severity => 5,
-profile => '/path/to/corporate/perlcriticrc',
-exclude => [
],
-include => [
'Subroutines:ProhibitUnusedPrivateSubroutines',
],
);
$policy->add_policy( -policy => 'Modules:ProhibitExcessMainComplexity'
+, -params => {max_mccabe => 10} )
foreach my $file (globidyglob some files) {
my @dohs = $policy->critique($file);
is(0, not scalar @dohs, "for shame!");
}
You could probably do it with Test::Perl::Critic, but I couldn't figure out how to get it to pass the max_mccabe param through off the top of my head and it's Friday beer O'clock time :)