File Coverage

lib/Code/Statistics/Metric.pm
Criterion Covered Total %
statement 22 24 91.6
branch n/a
condition n/a
subroutine 9 10 90.0
pod 5 5 100.0
total 36 39 92.3


line stmt bran cond sub pod time code
1 1     1   6 use strict;
  1         2  
  1         39  
2 1     1   6 use warnings;
  1         2  
  1         66  
3              
4             package Code::Statistics::Metric;
5             $Code::Statistics::Metric::VERSION = '1.190680';
6             # ABSTRACT: base class for Code::Statistic metrics
7              
8 1     1   23 use 5.004;
  1         3  
9              
10 1     1   479 use Module::Pluggable search_path => __PACKAGE__, require => 1, sub_name => 'all';
  1         808  
  1         5  
11              
12              
13             sub measure {
14 0     0 1 0 my ( $class, $target ) = @_;
15 0         0 return;
16             }
17              
18              
19             sub incompatible_with {
20 192     192 1 223 my ( $class, $target ) = @_;
21 192         288 return 0;
22             }
23              
24              
25             sub force_support {
26 256     256 1 303 my ( $class, $target ) = @_;
27 256         360 return 0;
28             }
29              
30              
31             sub short_name {
32 140     140 1 201 my ( $class ) = @_;
33 140         231 $class =~ s/Code::Statistics::Metric:://;
34 140         302 return $class;
35             }
36              
37              
38             sub is_insignificant {
39 12     12 1 14 my ( $class ) = @_;
40 12         25 return 0;
41             }
42              
43              
44             sub import {
45 2     2   9 Code::Statistics::Metric->all;
46 2         27621 return;
47             }
48              
49             1;
50              
51             __END__
52              
53             =pod
54              
55             =encoding UTF-8
56              
57             =head1 NAME
58              
59             Code::Statistics::Metric - base class for Code::Statistic metrics
60              
61             =head1 VERSION
62              
63             version 1.190680
64              
65             =head2 measure
66             Returns the metric of the given target.
67             Is called with the metric class name and a target object of unspecified
68             type.
69             This function should be overridden with specific logic to actually retrieve
70             the metric data.
71              
72             =head2 incompatible_with
73             Returns true if the given target is explicitly not supported by this metric.
74             Is called with the metric class name and a string representing the target
75             identifiers after 'Code::Statistics::Target::'.
76             Default is that all metrics are compatible with all targets.
77              
78             =head2 force_support
79             Returns true if the given target is forcibly supported by this metric.
80             Is called with the metric class name and a string representing the target
81             identifiers after 'Code::Statistics::Target::'.
82             Default is that no forcing happens.
83              
84             Has higher precedence than 'incompatible_with' and should be used to
85             override incompatibilities set by other targets.
86              
87             =head2 short_name
88             Allows a metric to return a short name, which can be used by shell report
89             builders for example.
90             Default is the class name, with 'Code::Statistics::Metric::' stripped out.
91             Override to customize.
92              
93             =head2 is_insignificant
94             Returns true if the metric is considered statistically insignificant.
95             Default is false.
96              
97             =head2 import
98              
99             Custom import to ensure that all possible metric plugins are loaded when
100             this module is loaded.
101              
102             =head1 AUTHOR
103              
104             Christian Walde <mithaldu@yahoo.de>
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108              
109             Christian Walde has dedicated the work to the Commons by waiving all of his
110             or her rights to the work worldwide under copyright law and all related or
111             neighboring legal rights he or she had in the work, to the extent allowable by
112             law.
113              
114             Works under CC0 do not require attribution. When citing the work, you should
115             not imply endorsement by the author.
116              
117             =cut