File: ProhibitExcessComplexity.run

package info (click to toggle)
libperl-critic-perl 1.088-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,792 kB
  • ctags: 1,556
  • sloc: perl: 17,417; lisp: 340; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 957 bytes parent folder | download
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
46
## name parm-based pass
## failures 0
## parms { max_mccabe => 100 }
## cut
sub test_sub {
    if ( $foo && $bar || $baz ) {
        open my $fh, '<', $file or die $!;
    }
    elsif ( $blah >>= some_function() ) {
        return if $barf;
    }
    else {
        $results = $condition ? 1 : 0;
    }
    croak unless $result;

    while( $condition ){ frobulate() }
    until( $foo > $baz ){ blech() }
}

#-----------------------------------------------------------------------------

## name parm-based failure
## failures 1
## parms { max_mccabe => 1 }
## cut
sub test_sub {
    if ( $foo && $bar || $baz ) {
        open my $fh, '<', $file or die $!;
    }
    elsif ( $blah >>= some_function() ) {
        return if $barf;
    }
    else {
        $results = $condition ? 1 : 0;
    }
    croak unless $result;
}

#-----------------------------------------------------------------------------

## name no-op sub
## failures 0
## cut
sub test_sub {
}