Apocalypse/PerlMetrics.pm

filter: Statementstmt 45.8% 22 / 48 Branchbran 25.0% 2 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 47.6% 30 / 63 CC 7 SCAR 29.0
CC
7
Cov
43%
do_test
30.3
BEGIN
1.0
BEGIN
1.0
CRAP 18.1
« Apocalypse/PerlCritic.pm ↑ Summary Apocalypse/Pod_Spelling.pm »
1 #
2 # This file is part of Test-Apocalypse
3 #
4 # This software is copyright (c) 2014 by Apocalypse.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 38 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
10 package Test::Apocalypse::PerlMetrics;
11 38 $Test::Apocalypse::PerlMetrics::VERSION = '1.006';
12 38 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
13 38 $Test::Apocalypse::PerlMetrics::AUTHORITY = 'cpan:APOCAL';
14 }
15  
16 # ABSTRACT: Plugin for Perl::Metrics::Simple
17  
18 38 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 38 ▶use Perl::Metrics::Simple 0.13;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 37 ▶sub do_test {
Subroutine do_test: called CC=7 SCAR=34.1
Pod undocumented
22 37 plan tests => 1;
23 37 my $analzyer = Perl::Metrics::Simple->new;
24 37 my $analysis = $analzyer->analyze_files( 'lib/' );
25 37 my $numdisplay = 10;
26  
27 37 ▶ if ( ok( $analysis->file_count(), 'Analyzed at least one file' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&ok(scalar $analysis->file_count, "Analyzed at least one file")) 37 0 37
28 # only print extra stuff if necessary
29 37 ▶ if ( $ENV{TEST_VERBOSE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"TEST_VERBOSE"}) 0 37 37
30 0 diag( '-- Perl Metrics Summary --' );
31 0 diag( ' File Count: ' . $analysis->file_count );
32 0 diag( ' Package Count: ' . $analysis->package_count );
33 0 diag( ' Subroutine Count: ' . $analysis->sub_count );
34 0 diag( ' Total Code Lines: ' . $analysis->lines );
35 0 diag( ' Non-Sub Lines: ' . $analysis->main_stats->{'lines'} );
36  
37 0 diag( '-- Subrotuine Metrics Summary --' );
38 0 my $summary_stats = $analysis->summary_stats;
39 0 diag( ' Min: lines(' . $summary_stats->{sub_length}->{min} . ') McCabe(' . $summary_stats->{sub_complexity}->{min} . ')' );
40 0 diag( ' Max: lines(' . $summary_stats->{sub_length}->{max} . ') McCabe(' . $summary_stats->{sub_complexity}->{max} . ')' );
41 0 diag( ' Mean: lines(' . $summary_stats->{sub_length}->{mean} . ') McCabe(' . $summary_stats->{sub_complexity}->{mean} . ')' );
42 0 diag( ' Standard Deviation: lines(' . $summary_stats->{sub_length}->{standard_deviation} . ') McCabe(' . $summary_stats->{sub_complexity}->{standard_deviation} . ')' );
43 0 diag( ' Median: lines(' . $summary_stats->{sub_length}->{median} . ') McCabe(' . $summary_stats->{sub_complexity}->{median} . ')' );
44  
45 0 diag( "-- Top$numdisplay subroutines by McCabe Complexity --" );
46 0 my @sorted_subs = reverse sort { $a->{'mccabe_complexity'} <=> $b->{'mccabe_complexity'} } @{ $analysis->subs };
47 0 foreach my $i ( 0 .. ( $numdisplay - 1 ) ) {
48 0 ▶ last if ! defined $sorted_subs[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sorted_subs[$i] 0 0 0
49  
50 diag( ' ' . $sorted_subs[$i]->{'path'} . ':' . $sorted_subs[$i]->{'name'} . ' ->' .
51 ' McCabe(' . $sorted_subs[$i]->{'mccabe_complexity'} . ')' .
52 0 ' lines(' . $sorted_subs[$i]->{'lines'} . ')'
53 );
54 }
55  
56 0 diag( "-- Top$numdisplay subroutines by lines --" );
57 0 @sorted_subs = reverse sort { $a->{'lines'} <=> $b->{'lines'} } @sorted_subs;
58 0 foreach my $i ( 0 .. ( $numdisplay - 1 ) ) {
59 0 ▶ last if ! defined $sorted_subs[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sorted_subs[$i] 0 0 0
60  
61 diag( ' ' . $sorted_subs[$i]->{'path'} . ':' . $sorted_subs[$i]->{'name'} . ' ->' .
62 ' lines(' . $sorted_subs[$i]->{'lines'} . ')' .
63 0 ' McCabe(' . $sorted_subs[$i]->{'mccabe_complexity'} . ')'
64 );
65 }
66  
67 #require Data::Dumper;
68 #diag( 'Summary Stats: ' . Data::Dumper::Dumper( $analysis->summary_stats ) );
69 #diag( 'File Stats: ' . Data::Dumper::Dumper( $analysis->file_stats ) );
70 }
71 }
72  
73 37 return;
74 }
75  
76 38 1;
77  
78 __END__
« Apocalypse/PerlCritic.pm ↑ Summary Apocalypse/Pod_Spelling.pm »