name (required)

Short label used in the report table, e.g. Tests.

description (required)

One-sentence description of what the check verifies.

check( $context ) (required)

Accepts an App::Project::Doctor::Context and returns a list of App::Project::Doctor::Finding objects (empty list on a clean pass).

can_fix

Returns true when this check can produce fixable findings. Default 0.

category

Grouping label for report presentation. Default general.

order

Numeric sort key: lower numbers appear first in the report. Default 50.

NAME

App::Project::Doctor::Check::Base - Base class for all check plugins

VERSION

0.01

SYNOPSIS

package App::Project::Doctor::Check::MyCheck;

use strict;
use warnings;
use autodie qw(:all);

use parent -norequire, 'App::Project::Doctor::Check::Base';

sub name        { 'My Check' }
sub description { 'Verifies something important.' }
sub can_fix     { 1 }
sub order       { 70 }

sub check {
    my ($self, $ctx) = @_;
    return () if $ctx->has_file('something-good');
    require App::Project::Doctor::Finding;
    return App::Project::Doctor::Finding->new(
        severity   => 'error',
        message    => 'Missing something-good',
        check_name => $self->name,
        fix        => sub { ... },
    );
}

1;

DESCRIPTION

Traditional OO base class that defines the interface every App::Project::Doctor::Check::* plugin must implement.

Calling name, description, or check on an instance that has not overridden them will croak at runtime with a clear message.

Subclasses inherit via:

use parent -norequire, 'App::Project::Doctor::Check::Base';

The -norequire flag is used because Base is always loaded by the orchestrator before the subclass is instantiated.

REQUIRED METHODS

Subclasses must implement name, description, and check. See "SYNOPSIS" for the expected signatures.

OPTIONAL METHODS

can_fix

Boolean -- default 0.

category

String grouping label -- default general.

order

Numeric sort key -- default 50.

MESSAGES

Code | Trigger                        | Resolution
-----|--------------------------------|----------------------------
B001 | name/description/check called  | Override the method in the
     | on base class directly         | subclass

FORMAL SPECIFICATION

Check == { name : String, description : String,
           check : Context -> [Finding],
           can_fix : Bool, category : String, order : N }

run : Check x Context -> [Finding]
run c ctx == check c ctx

AUTHOR

Nigel Horne <njh@nigelhorne.com>

LICENSE

Copyright (C) 2026 Nigel Horne. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.