| File: | blib/lib/App/Project/Doctor/Check/Base.pm |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | time | code |
|---|---|---|---|---|---|---|
| 1 | package App::Project::Doctor::Check::Base; | |||||
| 2 | ||||||
| 3 | 5 5 5 | 2744 5 75 | use strict; | |||
| 4 | 5 5 5 | 8 4 154 | use warnings; | |||
| 5 | 5 5 5 | 8 5 32 | use autodie qw(:all); | |||
| 6 | ||||||
| 7 | 5 5 5 | 10905 5 623 | use Carp qw(croak); | |||
| 8 | ||||||
| 9 | our $VERSION = '0.02'; | |||||
| 10 | ||||||
| 11 | # --------------------------------------------------------------------------- | |||||
| 12 | # Constructor | |||||
| 13 | # --------------------------------------------------------------------------- | |||||
| 14 | ||||||
| 15 | sub new { | |||||
| 16 | 153 | 149921 | my ($class, %args) = @_; | |||
| 17 | 153 | 432 | return bless {%args}, $class; | |||
| 18 | } | |||||
| 19 | ||||||
| 20 | # --------------------------------------------------------------------------- | |||||
| 21 | # Required interface -- subclasses MUST override these three | |||||
| 22 | # --------------------------------------------------------------------------- | |||||
| 23 | ||||||
| 24 - 28 | =head2 name (required) Short label used in the report table, e.g. C<Tests>. =cut | |||||
| 29 | ||||||
| 30 | sub name { | |||||
| 31 | 2 | 74 | croak ref(shift) . ' must implement name()'; | |||
| 32 | } | |||||
| 33 | ||||||
| 34 - 38 | =head2 description (required) One-sentence description of what the check verifies. =cut | |||||
| 39 | ||||||
| 40 | sub description { | |||||
| 41 | 2 | 321 | croak ref(shift) . ' must implement description()'; | |||
| 42 | } | |||||
| 43 | ||||||
| 44 - 49 | =head2 check( $context ) (required) Accepts an L<App::Project::Doctor::Context> and returns a list of L<App::Project::Doctor::Finding> objects (empty list on a clean pass). =cut | |||||
| 50 | ||||||
| 51 | sub check { | |||||
| 52 | 4 | 308 | croak ref(shift) . ' must implement check()'; | |||
| 53 | } | |||||
| 54 | ||||||
| 55 | # --------------------------------------------------------------------------- | |||||
| 56 | # Optional interface with sensible defaults | |||||
| 57 | # --------------------------------------------------------------------------- | |||||
| 58 | ||||||
| 59 - 63 | =head2 can_fix Returns true when this check can produce fixable findings. Default 0. =cut | |||||
| 64 | ||||||
| 65 | 5 | 33 | sub can_fix { 0 } | |||
| 66 | ||||||
| 67 - 71 | =head2 category Grouping label for report presentation. Default C<general>. =cut | |||||
| 72 | ||||||
| 73 | 15 | 967 | sub category { 'general' } | |||
| 74 | ||||||
| 75 - 79 | =head2 order Numeric sort key: lower numbers appear first in the report. Default 50. =cut | |||||
| 80 | ||||||
| 81 | 5 | 12 | sub order { 50 } | |||
| 82 | ||||||
| 83 | 1; | |||||
| 84 | ||||||