File: 00.1-critic.t

package info (click to toggle)
libpgobject-util-dbadmin-perl 1.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 176 kB
  • sloc: perl: 435; makefile: 6; sql: 3
file content (45 lines) | stat: -rw-r--r-- 797 bytes parent folder | download | duplicates (4)
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
44
45
use strict;
use warnings;
use Test::More; # plan automatically generated below
use File::Find;
use Perl::Critic;
use Perl::Critic::Violation;

my @on_disk;


sub test_files {
    my ($critic, $files) = @_;

    Perl::Critic::Violation::set_format( 'S%s %p %f: %l\n');

    for my $file (@$files) {
        my @findings = $critic->critique($file);

        ok(scalar(@findings) == 0, "Critique for $file");
        for my $finding (@findings) {
            diag ("$finding");
        }
    }

    return;
}

sub collect {
    return if $File::Find::name !~ m/\.(pm|pl|t)$/;

    my $module = $File::Find::name;
    push @on_disk, $module
}
find(\&collect, 'lib/');


plan tests => scalar(@on_disk);

test_files(
    Perl::Critic->new(
        -profile => 't/perlcriticrc',
    ),
    \@on_disk
);