| 1 | # ABSTRACT: Board configuration management | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package App::karr::Config; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 15 | our $VERSION = '0.602'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 15 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use YAML::XS qw( LoadFile DumpFile ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use JSON::MaybeXS qw( JSON ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 15 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 15 | has file => ( is => 'ro', required => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 15 | has data => ( is => 'lazy' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | sub _build_data { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_data: called CC=3 SCAR=13.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | my $file = $self->file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | return LoadFile($file->stringify) if defined $file && -f $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $file and -f $file
MC/DC0%0/2
defined $file and -f $file
defined $file
-f $file
Truth table33%1/3
A and B
A= defined $fileB= -f $file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | die "No file or data provided to Config\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub from_merged { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from_merged: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my ($class, $merged) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | return bless { data => $merged, file => undef }, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub save { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | DumpFile($self->file->stringify, $self->data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # The three list accessors below tolerate a malformed board config instead of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # dying inside a dereference. `karr config show` has to stay able to print a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # broken board so it can be fixed, and L</validate> checks the list shape | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # explicitly before it calls them, so nothing that should fail stops failing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # (ticket #78). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | ▶ | sub _list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_list: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | my ( $self, $key ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | my $value = $self->data->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | return ref $value eq 'ARRAY' ? @$value : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | ▶ | sub statuses { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
statuses: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | ref $_ ? $_->{name} : $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } $self->_list('statuses'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub status_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
status_config: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | for my $s ($self->_list('statuses')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if (ref $s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | return $s if $s->{name} eq $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } elsif ($s eq $name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | return { name => $s }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub priorities { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
priorities: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | return ref $self->data->{priorities} eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | ? @{ $self->data->{priorities} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | : qw( low medium high critical ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub classes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
classes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | ref $_ ? $_->{name} : $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } $self->_list('classes'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub claim_timeout { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
claim_timeout: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | return $self->data->{claim_timeout} // '1h'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->data->{"claim_timeout"} // "1h"
MC/DC0%0/1
$self->data->{"claim_timeout"} // "1h"
$self->data->{"claim_timeout"}
Truth table0%0/2
A
A= $self->data->{"claim_timeout"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub foundation_enabled { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
foundation_enabled: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my $f = $self->data->{foundation}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | return 1 unless ref $f eq 'HASH' && exists $f->{enabled}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $f eq "HASH" and exists $f->{"enabled"}
MC/DC0%0/2
ref $f eq "HASH" and exists $f->{"enabled"}
ref $f eq "HASH"
exists $f->{"enabled"}
Truth table0%0/3
A and B
A= ref $f eq "HASH"B= exists $f->{"enabled"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | return $f->{enabled} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub foundation_reason { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
foundation_reason: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my $f = $self->data->{foundation}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | return undef unless ref $f eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $reason = $f->{reason}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | return ( defined $reason && length $reason ) ? $reason : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $reason and length $reason
MC/DC0%0/2
defined $reason and length $reason
defined $reason
length $reason
Truth table0%0/3
A and B
A= defined $reasonB= length $reason
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | ▶ | sub parse_bool { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_bool: called CC=4 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | my ($class, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 1 | ▶ | die "Missing boolean value\n" unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 1 | my $v = lc $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 1 | $v =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1 | $v =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | ▶ | return 1 if $v =~ /^(?:1|true|yes|on)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | return 0 if $v =~ /^(?:0|false|no|off)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | die "Invalid boolean: $value (use true/false, yes/no, on/off, 1/0)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # Go's time.ParseDuration grammar, which is what kanban-md's claim_timeout is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # written in: an optional sign, then one or more decimal-number-plus-unit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | # groups. Note there is no day unit -- "7d" is an error in Go too. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 15 | my %DURATION_UNIT = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | ns => 1e-9, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | us => 1e-6, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | "\x{b5}s" => 1e-6, # micro sign | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | "\x{3bc}s" => 1e-6, # greek small letter mu | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ms => 1e-3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | s => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | m => 60, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | h => 3600, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub parse_duration { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_duration: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | my ($class, $str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | return undef unless defined $str && length $str; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $str and length $str
MC/DC0%0/2
defined $str and length $str
defined $str
length $str
Truth table0%0/3
A and B
A= defined $strB= length $str
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my $sign = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | $sign = -1 if $str =~ s/\A-//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $str =~ s/\A\+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # Go accepts a bare "0" (and only "0") without a unit. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | return 0 if $str =~ /\A0+\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my $seconds = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $matched = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | while ( length $str ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | $str =~ s/\A([0-9]*\.?[0-9]+)// or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | my $value = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | return undef if $value eq '.'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | $str =~ s/\A(ns|us|\x{b5}s|\x{3bc}s|ms|s|m|h)// or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $seconds += $value * $DURATION_UNIT{$1}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $matched++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | return undef unless $matched; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | return $sign * $seconds; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # Every rejection here is a usage error (ADR 0002), so it carries the same | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # "Usage error:" marker L<App::karr::Role::ExitCodes/usage_error> emits and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # F<bin/karr> maps to exit 2. These are plain class/instance methods rather than | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # calls to that role's method because App::karr::Config is not a command and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # does not consume it -- the marker is the contract, not the caller. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | sub _usage_error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_usage_error: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my ($field, $value, $detail) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | die sprintf "Usage error: invalid %s %s (%s)\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | $field, defined $value ? qq{"$value"} : '(none)', $detail; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # The status kanban-md calls "archived": always terminal, and the one name it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # hardcodes (internal/config/config.go, ArchivedStatus). Declared above the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | # validators because validate_status_filter names it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 15 | ▶ | use constant ARCHIVED_STATUS => 'archived'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | sub validate_status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_status: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my @statuses = $self->statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | return $value if defined $value && grep { $_ eq $value } @statuses; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value and grep {$_ eq $value;} @statuses
MC/DC0%0/2
defined $value and grep {$_ eq $value;} @statuses
defined $value
grep {$_ eq $value;} @statuses
Truth table0%0/3
A and B
A= defined $valueB= grep {$_ eq $value;} @statuses
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | _usage_error( 'status', $value, 'valid: ' . join(', ', @statuses) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | sub validate_status_filter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_status_filter: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my @valid = $self->statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | push @valid, ARCHIVED_STATUS unless grep { $_ eq ARCHIVED_STATUS } @valid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | return $value if defined $value && grep { $_ eq $value } @valid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value and grep {$_ eq $value;} @valid
MC/DC0%0/2
defined $value and grep {$_ eq $value;} @valid
defined $value
grep {$_ eq $value;} @valid
Truth table0%0/3
A and B
A= defined $valueB= grep {$_ eq $value;} @valid
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | _usage_error( 'status', $value, 'valid: ' . join(', ', @valid) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | sub validate_priority { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_priority: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my @priorities = $self->priorities; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | return $value if defined $value && grep { $_ eq $value } @priorities; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value and grep {$_ eq $value;} @priorities
MC/DC0%0/2
defined $value and grep {$_ eq $value;} @priorities
defined $value
grep {$_ eq $value;} @priorities
Truth table0%0/3
A and B
A= defined $valueB= grep {$_ eq $value;} @priorities
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | _usage_error( 'priority', $value, 'valid: ' . join(', ', @priorities) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | sub validate_class { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_class: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my @classes = $self->classes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | return $value if defined $value && grep { $_ eq $value } @classes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value and grep {$_ eq $value;} @classes
MC/DC0%0/2
defined $value and grep {$_ eq $value;} @classes
defined $value
grep {$_ eq $value;} @classes
Truth table0%0/3
A and B
A= defined $valueB= grep {$_ eq $value;} @classes
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | _usage_error( 'class', $value, 'valid: ' . join(', ', @classes) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | sub validate_due { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_due: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my ($class, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | _usage_error( 'due date', $value, 'expected YYYY-MM-DD' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value and $value =~ /\A(\d{4})-(\d{2})-(\d{2})\z/
MC/DC0%0/2
defined $value and $value =~ /\A(\d{4})-(\d{2})-(\d{2})\z/
defined $value
$value =~ /\A(\d{4})-(\d{2})-(\d{2})\z/
Truth table0%0/3
A and B
A= defined $valueB= $value =~ /\A(\d{4})-(\d{2})-(\d{2})\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | unless defined $value && $value =~ /\A(\d{4})-(\d{2})-(\d{2})\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my ( $y, $m, $d ) = ( $1, $2, $3 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # Calendar-correct, not just well-shaped: Go's time.Parse rejects 2026-02-30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # and so must karr, or the date sorts fine and means nothing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | _usage_error( 'due date', $value, 'expected YYYY-MM-DD' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$m >= 1 and $m <= 12 and $d >= 1 and $d <= _days_in_month($y, $m)
$m >= 1 and $m <= 12 and $d >= 1
$m >= 1 and $m <= 12
MC/DC0%0/4
$m >= 1 and $m <= 12 and $d >= 1 and $d <= _days_in_month($y, $m)
$m >= 1
$m <= 12
$d >= 1
$d <= _days_in_month($y, $m)
Truth table0%0/5
A and B and C and D
A= $m >= 1B= $m <= 12C= $d >= 1D= $d <= _days_in_month($y, $m)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | unless $m >= 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | && $m <= 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | && $d >= 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | && $d <= _days_in_month( $y, $m ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub _days_in_month { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_days_in_month: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my ( $year, $month ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my @days = ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | return 29 if $month == 2 && ( $year % 4 == 0 && ( $year % 100 != 0 || $year % 400 == 0 ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$month == 2 and ($year % 4 == 0 and $year % 100 != 0 || $year % 400 == 0)
$year % 4 == 0 and $year % 100 != 0 || $year % 400 == 0
$year % 100 != 0 or $year % 400 == 0
MC/DC0%0/4
$month == 2 and ($year % 4 == 0 and $year % 100 != 0 || $year % 400 == 0)
$month == 2
$year % 4 == 0
$year % 100 != 0
$year % 400 == 0
Truth table0%0/5
A and B and C or D
A= $month == 2B= $year % 4 == 0C= $year % 100 != 0D= $year % 400 == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | return $days[ $month - 1 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub validate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: not called CC=32 SCAR=69.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my ( $class, $data ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | die "Board config is invalid: not a mapping\n" unless ref $data eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $config = $class->from_merged($data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | die "Board config is invalid: board.name is required\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | unless ref $data->{board} eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | && defined $data->{board}{name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | && length $data->{board}{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
ref $data->{"board"} eq "HASH" and defined $data->{"board"}{"name"} and length $data->{"board"}{"name"}
ref $data->{"board"} eq "HASH" and defined $data->{"board"}{"name"}
MC/DC0%0/3
ref $data->{"board"} eq "HASH" and defined $data->{"board"}{"name"} and length $data->{"board"}{"name"}
ref $data->{"board"} eq "HASH"
defined $data->{"board"}{"name"}
length $data->{"board"}{"name"}
Truth table0%0/4
A and B and C
A= ref $data->{"board"} eq "HASH"B= defined $data->{"board"}{"name"}C= length $data->{"board"}{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | die "Board config is invalid: tasks_dir is required\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | unless defined $data->{tasks_dir} && length $data->{tasks_dir}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $data->{"tasks_dir"} and length $data->{"tasks_dir"}
MC/DC0%0/2
defined $data->{"tasks_dir"} and length $data->{"tasks_dir"}
defined $data->{"tasks_dir"}
length $data->{"tasks_dir"}
Truth table0%0/3
A and B
A= defined $data->{"tasks_dir"}B= length $data->{"tasks_dir"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | die "Board config is invalid: statuses must be a list\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | unless ref $data->{statuses} eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my @statuses = $config->statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | die "Board config is invalid: at least 2 statuses are required\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | unless @statuses >= 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | die "Board config is invalid: every status needs a name\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if grep { !defined || !length } @statuses; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_ && length $_
MC/DC0%0/2
defined $_ && length $_
defined $_
length $_
Truth table0%0/3
A && B
A= defined $_B= length $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | die "Board config is invalid: statuses contain duplicates\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | if _has_duplicates(@statuses); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | die "Board config is invalid: priorities must be a list\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | unless ref $data->{priorities} eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my @priorities = $config->priorities; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | die "Board config is invalid: at least 1 priority is required\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | unless @priorities >= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | die "Board config is invalid: priorities contain duplicates\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | if _has_duplicates(@priorities); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | if ( defined $data->{classes} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | die "Board config is invalid: classes must be a list\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | unless ref $data->{classes} eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my @classes = $config->classes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | die "Board config is invalid: every class needs a name\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | if grep { !defined || !length } @classes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_ && length $_
MC/DC0%0/2
defined $_ && length $_
defined $_
length $_
Truth table0%0/3
A && B
A= defined $_B= length $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | die "Board config is invalid: classes contain duplicates\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | if _has_duplicates(@classes); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | # Nothing checks a class entry beyond its name. karr used to validate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # `wip_limit >= 0` here without enforcing the limit anywhere, so a board | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # got a rejection for a setting that could never take effect (#227). Boards | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # written before that removal still carry the key; validate ignores keys it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # does not model, so such a board keeps saving and the key rides along in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | # refs/karr/config untouched -- karr does not scrub what it stopped reading. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | my $defaults = $data->{defaults} // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$data->{"defaults"} // {}
MC/DC0%0/1
$data->{"defaults"} // {}
$data->{"defaults"}
Truth table0%0/2
A
A= $data->{"defaults"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | die "Board config is invalid: defaults must be a mapping\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | unless ref $defaults eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | for my $spec ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | [ status => \@statuses ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | [ priority => \@priorities ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my ( $key, $allowed ) = @$spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my $value = $defaults->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | next unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | die "Board config is invalid: defaults.$key $value is not in the $key list\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | unless grep { $_ eq $value } @$allowed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | if ( defined $defaults->{class} && length $defaults->{class} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $defaults->{"class"} and length $defaults->{"class"}
MC/DC0%0/2
defined $defaults->{"class"} and length $defaults->{"class"}
defined $defaults->{"class"}
length $defaults->{"class"}
Truth table0%0/3
A and B
A= defined $defaults->{"class"}B= length $defaults->{"class"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my @classes = $config->classes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | die "Board config is invalid: defaults.class $defaults->{class} is not in the classes list\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | if @classes && !grep { $_ eq $defaults->{class} } @classes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@classes and not grep({$_ eq $defaults->{"class"};} @classes)
MC/DC0%0/2
@classes and not grep({$_ eq $defaults->{"class"};} @classes)
@classes
not grep({$_ eq $defaults->{"class"};} @classes)
Truth table0%0/3
A and not(B)
A= @classesB= not grep({$_ eq $defaults->{"class"};} @classes)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | if ( defined $data->{claim_timeout} && length $data->{claim_timeout} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $data->{"claim_timeout"} and length $data->{"claim_timeout"}
MC/DC0%0/2
defined $data->{"claim_timeout"} and length $data->{"claim_timeout"}
defined $data->{"claim_timeout"}
length $data->{"claim_timeout"}
Truth table0%0/3
A and B
A= defined $data->{"claim_timeout"}B= length $data->{"claim_timeout"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | die "Board config is invalid: claim_timeout $data->{claim_timeout} is not a duration\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | unless defined $class->parse_duration( $data->{claim_timeout} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | sub _has_duplicates { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_has_duplicates: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | return scalar grep { $seen{$_}++ } @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # The class of service that is ranked by its date rather than by its priority | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # (internal/board/pick.go, sortPickCandidates). Class names otherwise mean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # nothing to karr beyond their position in the board's `classes` list -- this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | # is the single exception, so it gets a name here rather than a literal in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # App::karr::Role::PickRules (ticket #233). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 15 | ▶ | use constant FIXED_DATE_CLASS => 'fixed-date'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # What a class-method call answers with, i.e. when there is no board config to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # derive from. It is the default board's own pair, so nothing that has always | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # asked App::karr::Config->is_terminal_status changes its answer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 15 | ▶ | use constant DEFAULT_TERMINAL_STATUSES => ( 'done', ARCHIVED_STATUS ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | sub is_terminal_status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_terminal_status: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | my ($self, $status) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | return 0 unless defined $status; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | return ( grep { $_ eq $status } $self->terminal_statuses ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | sub terminal_statuses { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
terminal_statuses: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # No instance, no configured statuses: the default board's pair. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | return ( DEFAULT_TERMINAL_STATUSES ) unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my @names = $self->statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | # kanban-md returns false for every status, archived included, when the board | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # configures none (internal/config/config.go, IsTerminalStatus). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | return () unless @names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # kanban-md's rule: the last configured status is terminal, unless that is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # `archived`, in which case the one before it is. `archived` is terminal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # either way, whether or not the board lists it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | my $last = $names[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | my $final = ( $last eq ARCHIVED_STATUS && @names > 1 ) ? $names[-2] : $last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$last eq "archived" and @names > 1
MC/DC0%0/2
$last eq "archived" and @names > 1
$last eq "archived"
@names > 1
Truth table0%0/3
A and B
A= $last eq "archived"B= @names > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | return grep { !$seen{$_}++ } ( $final, ARCHIVED_STATUS ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | # The status a card is held back in (ticket k306): filed, sorted, and taken by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # nobody until someone promotes it. The name itself, not a per-status flag: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # kanban-md drops a status key it does not know when it rewrites config.yml, so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # a flag would not survive a materialize -> kanban-md -> import round trip, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | # the hold would be gone without a word (the #87 class of loss). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 15 | ▶ | use constant HELD_BACK_STATUS => 'backlog'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | sub is_held_back_status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_held_back_status: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my ($self, $status) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | return 0 unless defined $status && $status eq HELD_BACK_STATUS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $status and $status eq "backlog"
MC/DC0%0/2
defined $status and $status eq "backlog"
defined $status
$status eq "backlog"
Truth table0%0/3
A and B
A= defined $statusB= $status eq "backlog"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # No instance: the default board, which has the column. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | return 1 unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | return ( grep { $_ eq $status } $self->statuses ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | sub promotion_status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
promotion_status: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | $self = $self->from_merged( $self->default_config ) unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my @statuses = $self->statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my ($at) = grep { $self->is_held_back_status( $statuses[$_] ) } 0 .. $#statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | return undef unless defined $at; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | my %terminal = map { $_ => 1 } $self->terminal_statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | my ($next) = grep { !$terminal{$_} } @statuses[ $at + 1 .. $#statuses ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | return $next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | sub handoff_status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handoff_status: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | # Asked on the class there is no board to derive from, so answer for the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | # default one -- the same convention is_terminal_status documents. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | $self = $self->from_merged( $self->default_config ) unless ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | # kanban-md's handoff targets the literal `review` and refuses a board that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | # does not configure one (cmd/handoff.go:105-110: "board has no 'review' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | # status; add one to use handoff"). Where the board has a review column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | # karr targets exactly that, so every board kanban-md itself can hand off on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # behaves the same here; where it has none the target is derived rather | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | # than refused -- the column a card sits in right before it is finished, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | # i.e. the last non-terminal status (ticket #102). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my @statuses = $self->statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | return 'review' if grep { $_ eq 'review' } @statuses; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | my %terminal = map { $_ => 1 } $self->terminal_statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my @open = grep { !$terminal{$_} } @statuses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | return $open[-1] if @open; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | _usage_error( 'status', 'review', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 'board configures no review column and has no non-terminal column to hand off to' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | sub status_requires_claim { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
status_requires_claim: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my ($self, $status_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # Through L</status_config> rather than walking `statuses` a second time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # (ticket #121). The bare-string rule t/53-config-semantics.t records -- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # only an explicit require_claim flag demands a claim -- survives the fold | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # because status_config synthesizes { name => $s } for a bare entry, which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # carries no require_claim key and so answers 0 here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $sc = $self->status_config($status_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | return 0 unless $sc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | return $sc->{require_claim} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 1 | ▶ | sub effective_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
effective_config: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 1 | my ($class, $overrides, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 1 | my $defaults = $class->default_config(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 1 | ▶ | return _merge_hashes($defaults, $overrides // {}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$overrides // {}
MC/DC0%0/1
$overrides // {}
$overrides
Truth table50%1/2
A
A= $overrides
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 5 | ▶ | sub default_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_config: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 5 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | version => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | board => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 5 | ▶ | name => $args{name} // 'Kanban Board', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"name"} // "Kanban Board"
MC/DC100%1/1
$args{"name"} // "Kanban Board"
$args{"name"}
Truth table100%2/2
A
A= $args{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | tasks_dir => 'tasks', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | statuses => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 'backlog', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 'todo', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | { name => 'in-progress', require_claim => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | { name => 'review', require_claim => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 'done', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 'archived', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | priorities => [qw( low medium high critical )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | classes => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | # No wip_limit / bypass_column_wip here: kanban-md gives its expedite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # class both, but karr enforces neither -- no command, role or mutation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | # path ever reads them. Carrying them in the defaults made every board | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | # advertise a setting that does nothing (ticket #227). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | { name => 'expedite' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | { name => 'fixed-date' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | { name => 'standard' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | { name => 'intangible' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | # Accepts the whole Go duration grammar kanban-md writes (`1h30m`); an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | # explicit zero (`0s`) disables claim expiry, the same way it does for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | # lock_timeout below (#232). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | claim_timeout => '1h', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # Deliberately not claim_timeout. A claim says "an agent owns this work" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | # and has to outlive a whole session; a lock only covers the few | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | # milliseconds `karr pick` spends deciding on and writing one card, and it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | # is the thing an agent that dies mid-pick leaves behind. Reusing the 1h | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # claim window here would leave that task unpickable for an hour (#45). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # Accepts Nh / Nm / Ns; an explicit zero (`0s`) disables lock expiry. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | lock_timeout => '5m', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # Board-level switch for automated agent runs (karr-foundation). Boards are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # enabled by default; `karr disable` writes enabled => 0 (plus an optional | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # reason) into refs/karr/config so the opt-out syncs with the board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | foundation => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | enabled => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | defaults => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | status => 'backlog', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | priority => 'medium', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | class => 'standard', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | # The config keys kanban-md's Go schema types as `bool` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # (internal/config/config.go): StatusConfig.RequireClaim / .ShowDuration, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # ClassConfig.BypassColumnWIP, TUIConfig.HideEmptyColumns -- plus karr's own | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | # foundation.enabled, which kanban-md ignores but which is a boolean all the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # same. Listed here, next to default_config, so the two stay in step. Three of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | # them (show_duration, bypass_column_wip, hide_empty_columns) are keys karr does | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # not model and never writes itself; they stay listed because a board may still | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # carry one -- from an older karr or a hand-edited config -- and materialize has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | # to hand kanban-md a real boolean or go-yaml refuses the whole file (#60). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 15 | my %BOOLEAN_KEY = map { $_ => 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | qw( require_claim show_duration bypass_column_wip hide_empty_columns enabled ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | sub file_view_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_view_config: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | my ($class, $effective, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my $view = _booleanize($effective); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # kanban-md validates next_id >= 1 and refuses a config without it. karr keeps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | # the counter in refs/karr/meta/next-id instead, so materialize copies it into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | # the view; import drops it again and leaves the ref authoritative. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | my $next_id = $args{next_id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | $view->{next_id} = ( defined $next_id && $next_id >= 1 ) ? $next_id : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $next_id and $next_id >= 1
MC/DC0%0/2
defined $next_id and $next_id >= 1
defined $next_id
$next_id >= 1
Truth table0%0/3
A and B
A= defined $next_idB= $next_id >= 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return $view; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | # The board-config keys a file view is allowed to speak for on the way back in, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | # i.e. the ones karr itself models. `version` is deliberately absent: it is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | # karr's own numbering, and kanban-md rewrites the view's to its own on every | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | # load. So are `tui` and `wip_limits` -- kanban-md regenerates those from its | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | # defaults whenever it migrates a config, and `karr config` can neither show nor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | # set them, so adopting them would freeze another tool's defaults into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | # refs/karr/config as invisible, uneditable overrides (ticket #88). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 15 | my %VIEW_KEY = map { $_ => 1 } qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | board tasks_dir statuses priorities classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | claim_timeout lock_timeout foundation defaults | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | # The same question one level down, inside a status or class entry. A class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # entry is its name and nothing else: kanban-md decorates its expedite class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | # with `wip_limit` and `bypass_column_wip`, and karr enforces neither, so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | # adopting them would freeze another tool's defaults into refs/karr/config as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | # an override nobody chose -- the same argument `wip_limits` gets one level up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | # and `show_duration` gets beside it (#88, #227). The pruning is one-way: a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | # board that already carries the keys keeps them, they just cannot come back in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | # through a file view. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 15 | my %VIEW_STATUS_KEY = map { $_ => 1 } qw( name require_claim ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 15 | my %VIEW_CLASS_KEY = map { $_ => 1 } qw( name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | sub reconcile_view_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reconcile_view_config: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | my ( $class, $overrides, $view ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | return _merge_hashes( $overrides // {}, _view_overrides($view) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$overrides // {}
MC/DC0%0/1
$overrides // {}
$overrides
Truth table0%0/2
A
A= $overrides
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | sub _view_overrides { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_view_overrides: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | my ($view) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | return {} unless ref $view eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | my %kept = map { $_ => $view->{$_} } grep { $VIEW_KEY{$_} } keys %$view; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | $kept{statuses} = [ map { _view_entry( $_, \%VIEW_STATUS_KEY, 1 ) } @{ $kept{statuses} } ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | if ref $kept{statuses} eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | $kept{classes} = [ map { _view_entry( $_, \%VIEW_CLASS_KEY, 0 ) } @{ $kept{classes} } ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | if ref $kept{classes} eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | return \%kept; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # Prune one status or class entry to the keys karr models and -- for statuses -- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # collapse a mapping that says nothing beyond its name back to the bare string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # L</default_config> uses in exactly that case. Both halves are needed to make a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # kanban-md config compare equal to karr's defaults instead of being stored as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | # an override: kanban-md writes every status as a mapping, and its v7->v8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | # migration decorates half of them with `show_duration`, which karr does not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # model. Classes are never collapsed -- karr's default classes stay mappings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | # even when `name` is all they carry. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | sub _view_entry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_view_entry: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | my ( $entry, $allowed, $collapse ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | ▶ | return $entry unless ref $entry eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | my %kept = map { $_ => $entry->{$_} } grep { $allowed->{$_} } keys %$entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | return $kept{name} if $collapse && keys(%kept) == 1 && defined $kept{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$collapse and keys %kept == 1 and defined $kept{"name"}
$collapse and keys %kept == 1
MC/DC0%0/3
$collapse and keys %kept == 1 and defined $kept{"name"}
$collapse
keys %kept == 1
defined $kept{"name"}
Truth table0%0/4
A and B and C
A= $collapseB= keys %kept == 1C= defined $kept{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | return \%kept; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | ▶ | sub _booleanize { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_booleanize: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | my ($data, $key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | my $ref = ref $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | return { map { $_ => _booleanize( $data->{$_}, $_ ) } keys %$data } if $ref eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | # No key is passed down into array elements: boolean keys only ever name a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # hash value, and a list member is a status/class hash or a plain string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | return [ map { _booleanize($_) } @$data ] if $ref eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | return $data if $ref; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | return $data unless defined $key && $BOOLEAN_KEY{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $key and $BOOLEAN_KEY{$key}
MC/DC0%0/2
defined $key and $BOOLEAN_KEY{$key}
defined $key
$BOOLEAN_KEY{$key}
Truth table0%0/3
A and B
A= defined $keyB= $BOOLEAN_KEY{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | return $data unless defined $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | return $data ? JSON->true : JSON->false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 3 | ▶ | sub _merge_hashes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_merge_hashes: called CC=6 SCAR=18.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 3 | my ($left, $right) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 3 | ▶ | my %merged = %{$left // {}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$left // {}
MC/DC0%0/1
$left // {}
$left
Truth table50%1/2
A
A= $left
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 3 | ▶ | for my $key (keys %{$right // {}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$right // {}
MC/DC0%0/1
$right // {}
$right
Truth table50%1/2
A
A= $right
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 5 | ▶ | if (ref($merged{$key}) eq 'HASH' && ref($right->{$key}) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $merged{$key} eq "HASH" and ref $right->{$key} eq "HASH"
MC/DC50%1/2
ref $merged{$key} eq "HASH" and ref $right->{$key} eq "HASH"
ref $merged{$key} eq "HASH"
ref $right->{$key} eq "HASH"
Truth table66%2/3
A and B
A= ref $merged{$key} eq "HASH"B= ref $right->{$key} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 2 | $merged{$key} = _merge_hashes($merged{$key}, $right->{$key}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 3 | $merged{$key} = $right->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 3 | return \%merged; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||