File: 30-perlcritic.t

package info (click to toggle)
libhttp-server-simple-cgi-prefork-perl 6-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 152 kB
  • ctags: 6
  • sloc: perl: 282; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,077 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use strict;
use warnings;
use File::Spec;
use Test::More;

eval "use Test::Pod::Coverage 1.04";
plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;

use Data::Dumper;
use English qw(-no_match_vars);

if ( not $ENV{TEST_CRITIC} ) {
    my $msg = 'Perl::Critic test.  Set $ENV{TEST_CRITIC} to a true value to run.';
    plan( skip_all => $msg );
}

eval { require Test::Perl::Critic; };

if ( $EVAL_ERROR ) {
   my $msg = 'Test::Perl::Critic required to criticise code';
   plan( skip_all => $msg );
}

my @modules = all_modules();
my $tests = 0;
my @fnames;
foreach my $module (@modules) {
    next if($module =~ /Cache::Memcached/);
    my $fname = 'lib/' . $module . '.pm';
    $fname =~ s/\:\:/\//go;
    $tests++;
    push @fnames, $fname;
}
plan(tests => $tests);


my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' );
Test::Perl::Critic->import( -profile => $rcfile, -verbose => "[%p] %m at line %l, column %c.  (Severity: %s)\n   %e\n");
#all_critic_ok();
foreach my $fname (@fnames) {
    #diag "** $fname";
    critic_ok($fname);
}