File Coverage: lib/Code/Statistics/Target.pm

# File Coverage

File: | lib/Code/Statistics/Target.pm
Coverage: | 88.0%

line | stmt | bran | cond | sub | pod | time | code
--- | --- | --- | --- | --- | --- | --- | ---
1 | 1 1 1 |  |  | 1 |  | 0 0 0 | use strict;
2 | 1 1 1 |  |  | 1 |  | 0 0 0 | use warnings;
3 |
4 |  |  |  |  |  |  | package Code::Statistics::Target;
5 |
6 |  |  |  |  |  |  | # ABSTRACT: base class for Code::Statistic targets
7 |
8 | 1 1 1 |  |  | 1 |  | 0 0 0 | use 5.004;
9 |
10 | 1 1 1 |  |  | 1 |  | 0 0 0 | use Module::Pluggable search_path => __PACKAGE__, require => 1, sub_name => 'all';
11 |
12 - 18 |  |
    =head2 find_targets
        Returns an arrayref to a list of targets found in the given file.
        Is called with the target class name and a Code::Statistics::File object.
        This function should be overridden with specific logic to actually retrieve
        the target list.

    =cut
19 |
20 |  |  |  |  |  |  | sub find_targets {
21 | 0 |  |  | 0 |  | 0 | my ( $class, $file ) = @_;
22 | 0 |  |  |  |  | 0 | return [];
23 |  |  |  |  |  |  | }
24 |
25 - 30 |  |
    =head2 incompatible_with
        Returns true if the given metric is explicitly not supported by this target.
        Is called with the target class name and a string representing the metric
        identifiers after 'Code::Statistics::Metric::'.
        Default is that all targets are compatible with all metrics.
    =cut
31 |
32 |  |  |  |  |  |  | sub incompatible_with {
33 | 168 |  |  | 168 |  | 0 | my ( $class, $target ) = @_;
34 | 168 |  |  |  |  | 0 | return 0;
35 |  |  |  |  |  |  | }
36 |
37 - 45 |  |
    =head2 force_support
        Returns true if the given metric is forcibly supported by this target.
        Is called with the target class name and a string representing the metric
        identifiers after 'Code::Statistics::Metric::'.
        Default is that no forcing happens.

        Has higher precedence than 'incompatible_with' and should be used to
        override incompatibilities set by other metrics.
    =cut
46 |
47 |  |  |  |  |  |  | sub force_support {
48 | 168 |  |  | 168 |  | 0 | my ( $class, $target ) = @_;
49 | 168 |  |  |  |  | 0 | return 0;
50 |  |  |  |  |  |  | }
51 |
52 |  |  |  |  |  |  | 1;