lib/App/GHGen/CostEstimator.pm

filter: Statementstmt 100% 129 / 129 Branchbran 96.1% 75 / 78 Conditioncond 90.0% 18 / 20 MC/DCmcdc 75.0% 9 / 12 Subroutinesub 100% 14 / 14 Podpod 37.5% 3 / 8 totaltotal 95.0% 248 / 261 CC 59 SCAR 22.6
CC
59
Cov
98%
estimate_savings
15.0
estimate_job_duration
13.0
estimate_matrix_factor
10.0
CRAP 9.6
« lib/App/GHGen/Detector.pm ↑ Summary blib/lib/App/GHGen/Reporter.pm »
1 package App::GHGen::CostEstimator;
2  
3 64 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 64 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 64 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 64 ▶use YAML::XS qw(LoadFile);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 64 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 64 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 64 our @EXPORT_OK = qw(
11 estimate_current_usage
12 estimate_savings
13 estimate_workflow_cost
14 );
15  
16 64 our $VERSION = '0.13';
17  
18 =encoding utf-8
19  
20 =head1 NAME
21  
22 App::GHGen::CostEstimator - Estimate CI costs and savings
23  
24 =head1 SYNOPSIS
25  
26 use App::GHGen::CostEstimator qw(estimate_current_usage);
27  
28 my $estimate = estimate_current_usage(\@workflows);
29  
30 =head1 FUNCTIONS
31  
32 =head2 estimate_current_usage($workflows)
33  
34 Estimate current monthly CI usage based on workflow configurations.
35  
36 =head3 Purpose
37  
38 Load and analyse every workflow file in C<$workflows>, then aggregate
39 estimated runs, minutes, and cost into a single summary hash.
40  
41 =head3 Arguments
42  
43 =over 4
44  
45 =item C<$workflows> (ArrayRef[Path::Tiny], required)
46  
47 Array reference of L<Path::Tiny> objects pointing to YAML workflow files.
48 Each file is loaded with C<YAML::XS::LoadFile>.
49  
50 =back
51  
52 =head3 Returns
53  
54 A hash reference with keys:
55  
56 {
57 total_minutes => Num,
58 billable_minutes => Num, # 0 when within free tier (2 000 min/month)
59 monthly_cost => Num, # USD; 0 when within free tier
60 workflows => ArrayRef[ estimate_workflow_cost result ],
61 }
62  
63 =head3 Side Effects
64  
65 Reads each workflow file from disk via C<YAML::XS::LoadFile>.
66  
67 =head3 Usage Example
68  
69 use App::GHGen::CostEstimator qw(estimate_current_usage);
70 use App::GHGen::Analyzer qw(find_workflows);
71  
72 my @wfs = find_workflows();
73 my $usage = estimate_current_usage(\@wfs);
74 printf "Monthly cost: \$%.2f\n", $usage->{monthly_cost};
75  
76 =head3 API SPECIFICATION
77  
78 =head4 Input
79  
80 { workflows => { type => 'arrayref', required => 1 } }
81  
82 =head4 Output
83  
84 {
85 type => 'hashref',
86 keys => {
87 total_minutes => { type => 'scalar' },
88 billable_minutes => { type => 'scalar' },
89 monthly_cost => { type => 'scalar' },
90 workflows => { type => 'arrayref' },
91 },
92 }
93  
94 =head3 FORMAL SPECIFICATION
95  
96 FREE_TIER ≔ 2000
97 COST_PER_MIN ≔ 0.008
98  
99 estimate_current_usage : seq Path → UsageSummary
100  
101 total ≔ ∑ { estimate_workflow_cost(f).minutes_per_month ∣ f ∈ workflows }
102 billable ≔ max(0, total − FREE_TIER)
103  
104 result ≔ {
105 total_minutes ↦ total,
106 billable_minutes ↦ billable,
107 monthly_cost ↦ billable × COST_PER_MIN,
108 workflows ↦ [ estimate_workflow_cost(f) ∣ f ∈ workflows ],
109 }
110  
111 =cut
112  
113 10 ▶sub estimate_current_usage($workflows) {
Subroutine estimate_current_usage: called CC=3 SCAR=11.0
Pod documented
114 10 my $total_minutes = 0;
115 10 my @workflow_costs;
116  
117 10 for my $wf_file (@$workflows) {
118 11 my $workflow = LoadFile($wf_file);
119 10 my $cost = estimate_workflow_cost($workflow, $wf_file->basename);
120  
121 10 $total_minutes += $cost->{minutes_per_month};
122 10 push @workflow_costs, $cost;
123 }
124  
125 # GitHub pricing (approximate)
126 # Free tier: 2,000 minutes/month for private repos
127 # Additional: $0.008 per minute
128 9 my $cost_per_minute = 0.008;
129 9 my $free_tier = 2000;
130  
131 9 ▶ my $billable_minutes = $total_minutes > $free_tier ? ($total_minutes - $free_tier) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$total_minutes > $free_tier ? : 2 7 9
132  
133 9 my $monthly_cost = $billable_minutes * $cost_per_minute;
134  
135 return {
136 9 total_minutes => $total_minutes,
137 billable_minutes => $billable_minutes,
138 monthly_cost => $monthly_cost,
139 workflows => \@workflow_costs,
140 };
141 }
142  
143 =head2 estimate_workflow_cost($workflow, $filename)
144  
145 Estimate the monthly CI cost of a single parsed workflow.
146  
147 =head3 Purpose
148  
149 Compute estimated runs per month, average run duration, and total minute
150 usage for one workflow, based on its trigger configuration and step complexity.
151  
152 =head3 Arguments
153  
154 =over 4
155  
156 =item C<$workflow> (HashRef, required)
157  
158 A parsed workflow hash (e.g. from C<YAML::XS::LoadFile>).
159  
160 =item C<$filename> (Str, required)
161  
162 Filename string used as a display label when C<$workflow-E<gt>{name}> is absent.
163  
164 =back
165  
166 =head3 Returns
167  
168 A hash reference:
169  
170 {
171 name => Str,
172 file => Str,
173 runs_per_month => Num,
174 minutes_per_run => Num,
175 minutes_per_month => Num, # == runs_per_month * minutes_per_run
176 }
177  
178 =head3 Side Effects
179  
180 None. Pure function.
181  
182 =head3 Usage Example
183  
184 my $cost = estimate_workflow_cost($workflow, 'ci.yml');
185 printf "%s: %d min/month\n", $cost->{name}, $cost->{minutes_per_month};
186  
187 =head3 API SPECIFICATION
188  
189 =head4 Input
190  
191 {
192 workflow => { type => 'hashref', required => 1 },
193 filename => { type => 'scalar', required => 1 },
194 }
195  
196 =head4 Output
197  
198 {
199 type => 'hashref',
200 keys => {
201 name => { type => 'scalar' },
202 file => { type => 'scalar' },
203 runs_per_month => { type => 'scalar' },
204 minutes_per_run => { type => 'scalar' },
205 minutes_per_month => { type => 'scalar' },
206 },
207 }
208  
209 =head3 FORMAL SPECIFICATION
210  
211 estimate_workflow_cost : Workflow × ℤ* → CostRecord
212  
213 runs ≔ estimate_runs_per_month(w)
214 dur ≔ estimate_duration(w)
215 result ≔ {
216 name ↦ w.name ?? f,
217 file ↦ f,
218 runs_per_month ↦ runs,
219 minutes_per_run ↦ dur,
220 minutes_per_month ↦ runs × dur,
221 }
222  
223 invariant: result.minutes_per_month = result.runs_per_month × result.minutes_per_run
224  
225 =cut
226  
227 11 ▶sub estimate_workflow_cost($workflow, $filename) {
Subroutine estimate_workflow_cost: called CC=2 SCAR=7.0
Pod documented
228 11 ▶ my $name = $workflow->{name} // $filename;
Condition66%2/3
$workflow->{"name"} // $filename
l!l&&r!l&&!r
1010
MC/DC0%0/2
$workflow->{"name"} // $filename
$workflow->{"name"} $filename
Truth table66%2/3
A // B
A= $workflow->{"name"}B= $filename
ABresult
1X1
011
000
229  
230 # Estimate triggers per month
231 11 my $runs_per_month = estimate_runs_per_month($workflow);
232  
233 # Estimate duration per run
234 11 my $minutes_per_run = estimate_duration($workflow);
235  
236 # Calculate total
237 11 my $minutes_per_month = $runs_per_month * $minutes_per_run;
238  
239 return {
240 11 name => $name,
241 file => $filename,
242 runs_per_month => $runs_per_month,
243 minutes_per_run => $minutes_per_run,
244 minutes_per_month => $minutes_per_month,
245 };
246 }
247  
248 =head2 estimate_savings($issues, $workflows)
249  
250 Estimate potential CI-minute and cost savings from resolving a set of issues.
251  
252 =head3 Purpose
253  
254 For each issue in C<$issues>, compute how many CI minutes per month would be
255 saved by fixing it. Optionally uses C<$workflows> to proportion savings
256 against actual current usage.
257  
258 =head3 Arguments
259  
260 =over 4
261  
262 =item C<$issues> (ArrayRef[HashRef], required)
263  
264 Array reference of issue hashes, each with at least C<type> and C<message>.
265  
266 =item C<$workflows> (ArrayRef[Path::Tiny], optional, default C<[]>)
267  
268 Workflow files used to compute current usage for percentage calculations.
269  
270 =back
271  
272 =head3 Returns
273  
274 A hash reference:
275  
276 {
277 minutes => Int, # total minutes saved per month
278 percentage => Int, # 0-100; 0 when no current usage available
279 cost => Str, # formatted as "NN.NN" (USD)
280 details => ArrayRef[{ description => Str, minutes => Int, issue_type => Str }],
281 }
282  
283 =head3 Side Effects
284  
285 May read workflow files from disk when C<$workflows> is non-empty.
286  
287 =head3 Usage Example
288  
289 my $savings = estimate_savings(\@issues, \@workflow_paths);
290 printf "Save %d min/month (\$%s)\n",
291 $savings->{minutes}, $savings->{cost};
292  
293 =head3 API SPECIFICATION
294  
295 =head4 Input
296  
297 {
298 issues => { type => 'arrayref', required => 1 },
299 workflows => { type => 'arrayref', default => [] },
300 }
301  
302 =head4 Output
303  
304 {
305 type => 'hashref',
306 keys => {
307 minutes => { type => 'scalar' },
308 percentage => { type => 'scalar' },
309 cost => { type => 'scalar' },
310 details => { type => 'arrayref' },
311 },
312 }
313  
314 =head3 FORMAL SPECIFICATION
315  
316 estimate_savings : seq Issue × seq Path → SavingsSummary
317  
318 savings(i) ≔
319 i.type = performance ∧ i.message =~ /caching/ → 75
320 i.type = cost ∧ i.message =~ /concurrency/ → 50 | usage×0.15
321 i.type = cost ∧ i.message =~ /triggers/ → 100 | usage×0.25
322 otherwise → 0
323  
324 total ≔ ∑ { savings(i) ∣ i ∈ issues }
325 result ≔ {
326 minutes ↦ floor(total),
327 percentage ↦ floor(total / usage × 100) | 30 (if total > 0, no usage),
328 cost ↦ sprintf("%.2f", total × 0.008),
329 details ↦ [ { description, minutes, issue_type } ∣ savings(i) > 0 ],
330 }
331  
332 =cut
333  
334 22 ▶sub estimate_savings($issues, $workflows = []) {
Subroutine estimate_savings: called CC=15 SCAR=27.1
Pod documented
335 22 my %savings = (
336 minutes => 0,
337 percentage => 0,
338 cost => 0,
339 details => [],
340 );
341  
342 # Get current usage if workflows provided
343 22 ▶ my $current_usage = @$workflows ? estimate_current_usage($workflows) : undef;
Branch: 1 branch
BranchTrueFalseTotal
@$workflows ? : 8 14 22
344  
345 22 for my $issue (@$issues) {
346 27 my $saving = 0;
347 27 my $description = '';
348  
349 27 ▶ if ($issue->{type} eq 'performance') {
Branch: 2 branches
BranchTrueFalseTotal
if ($issue->{'type'} eq 'performance') { } 13 14 27
elsif ($issue->{'type'} eq 'cost') { } 11 3 14
350 13 ▶ if ($issue->{message} =~ /caching/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($issue->{"message"} =~ /caching/u) 11 2 13
351 # Caching typically saves 30-60 seconds per run
352 # Estimate 100 runs/month affected
353 11 $saving = 100 * 0.75; # 75 minutes
354 11 $description = 'Adding dependency caching';
355 }
356 }
357 elsif ($issue->{type} eq 'cost') {
358 11 ▶ if ($issue->{message} =~ /concurrency/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($issue->{'message'} =~ /concurrency/u) { } 6 5 11
elsif ($issue->{'message'} =~ /triggers/u) { } 4 1 5
359 # Concurrency saves by canceling superseded runs
360 # Estimate 10-20% of runs are canceled
361 6 ▶ if ($current_usage) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_usage) { } 2 4 6
362 2 $saving = $current_usage->{total_minutes} * 0.15;
363 } else {
364 4 $saving = 50; # Conservative estimate
365 }
366 6 $description = 'Adding concurrency controls';
367 }
368 elsif ($issue->{message} =~ /triggers/) {
369 # Trigger filters reduce unnecessary runs
370 # Estimate 20-30% of runs avoided
371 4 ▶ if ($current_usage) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_usage) { } 2 2 4
372 2 $saving = $current_usage->{total_minutes} * 0.25;
373 } else {
374 2 $saving = 100; # Conservative estimate
375 }
376 4 $description = 'Optimizing workflow triggers';
377 }
378 }
379  
380 27 ▶ if ($saving > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($saving > 0) 21 6 27
381 21 $savings{minutes} += $saving;
382 21 push @{$savings{details}}, {
383 description => $description,
384 minutes => int($saving),
385 issue_type => $issue->{type},
386 21 };
387 }
388 }
389  
390 # Calculate percentage and cost
391 22 ▶ if ($current_usage && $current_usage->{total_minutes} > 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($current_usage and $current_usage->{'total_minutes'} > 0) { } 7 15 22
elsif ($savings{'minutes'} > 0) { } 10 5 15
Condition100%3/3
$current_usage and $current_usage->{"total_minutes"} > 0
!ll&&!rl&&r
1417
MC/DC100%2/2
$current_usage and $current_usage->{"total_minutes"} > 0
$current_usage $current_usage->{"total_minutes"} > 0
Truth table100%3/3
A and B
A= $current_usageB= $current_usage->{"total_minutes"} > 0
ABresult
0X0
100
111
392 7 $savings{percentage} = int(($savings{minutes} / $current_usage->{total_minutes}) * 100);
393 } elsif ($savings{minutes} > 0) {
394 10 $savings{percentage} = 30; # Estimate 30% savings
395 }
396  
397 22 $savings{cost} = sprintf('%.2f', $savings{minutes} * 0.008);
398 22 $savings{minutes} = int($savings{minutes});
399  
400 22 return \%savings;
401 }
402  
403 18 ▶sub estimate_runs_per_month($workflow) {
Subroutine estimate_runs_per_month: called CC=7 SCAR=19.5
Pod undocumented
404 18 ▶ my $on = $workflow->{on} or return 50; # Default estimate
Branch: 1 branch
BranchTrueFalseTotal
my $on = $workflow->{"on"} or return 50 15 3 18
405  
406 15 my $runs = 0;
407  
408 # Parse different trigger formats
409 15 ▶ if (ref $on eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $on eq 'ARRAY') { } 2 13 15
elsif (ref $on eq 'HASH') { } 8 5 13
410 2 for my $trigger (@$on) {
411 2 $runs += estimate_trigger_frequency($trigger);
412 }
413 }
414 elsif (ref $on eq 'HASH') {
415 8 for my $trigger (keys %$on) {
416 10 $runs += estimate_trigger_frequency($trigger, $on->{$trigger});
417 }
418 } else {
419 5 $runs += estimate_trigger_frequency($on);
420 }
421  
422 15 ▶ return $runs || 50; # Minimum estimate
Condition100%2/2
$runs || 50
l!l
141
MC/DC100%1/1
$runs || 50
$runs
Truth table100%2/2
A
A= $runs
Aresult
11
00
423 }
424  
425 26 ▶sub estimate_trigger_frequency($trigger, $config = undef) {
Subroutine estimate_trigger_frequency: called CC=7 SCAR=19.5
Pod undocumented
426 # Estimates based on typical project activity
427 26 my %frequencies = (
428 push => 100, # ~5 pushes/day for active projects
429 pull_request => 60, # ~2-3 PRs/day
430 schedule => 30, # Depends on cron, assume daily
431 workflow_dispatch => 10, # Manual runs
432 release => 4, # ~1 per week
433 issues => 20, # Issue activity
434 );
435  
436 26 ▶ my $base = $frequencies{$trigger} // 20;
Condition100%2/2
$frequencies{$trigger} // 20
l!l
242
MC/DC100%1/1
$frequencies{$trigger} // 20
$frequencies{$trigger}
Truth table100%2/2
A
A= $frequencies{$trigger}
Aresult
11
00
437  
438 # Adjust based on configuration
439 26 ▶ if ($config && ref $config eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if ($config and ref $config eq "HASH") 15 11 26
Condition66%2/3
$config and ref $config eq "HASH"
!ll&&!rl&&r
11015
MC/DC50%1/2
$config and ref $config eq "HASH"
$config ref $config eq "HASH"
Truth table66%2/3
A and B
A= $configB= ref $config eq "HASH"
ABresult
0X0
100
111
440 # If it has branches filter, likely fewer runs
441 15 ▶ if ($config->{branches}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($config->{"branches"}) 8 7 15
442 8 $base *= 0.6; # 40% reduction
443 }
444  
445 # If it has paths filter, significantly fewer runs
446 15 ▶ if ($config->{paths}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($config->{"paths"}) 3 12 15
447 3 $base *= 0.3; # 70% reduction
448 }
449 }
450  
451 26 return int($base);
452 }
453  
454 15 ▶sub estimate_duration($workflow) {
Subroutine estimate_duration: called CC=9 SCAR=22.0
Pod undocumented
455 15 ▶ my $jobs = $workflow->{jobs} or return 5; # Default 5 minutes
Branch: 1 branch
BranchTrueFalseTotal
my $jobs = $workflow->{"jobs"} or return 5 14 1 15
456  
457 14 my $total_duration = 0;
458 14 my $max_parallel_duration = 0;
459  
460 # Check if jobs run in parallel or sequence
461 14 my $has_dependencies = 0;
462 14 for my $job (values %$jobs) {
463 18 ▶ $has_dependencies = 1 if $job->{needs};
Branch: 1 branch
BranchTrueFalseTotal
if $job->{"needs"} 2 16 18
464 }
465  
466 14 for my $job (values %$jobs) {
467 18 my $duration = estimate_job_duration($job);
468  
469 18 ▶ if ($has_dependencies) {
Branch: 1 branch
BranchTrueFalseTotal
if ($has_dependencies) { } 4 14 18
470 # Sequential - add durations
471 4 $total_duration += $duration;
472 } else {
473 # Parallel - track maximum
474 14 ▶ $max_parallel_duration = $duration if $duration > $max_parallel_duration;
Branch: 1 branch
BranchTrueFalseTotal
if $duration > $max_parallel_duration 14 0 14
475 }
476 }
477  
478 14 ▶ my $estimated = $has_dependencies ? $total_duration : $max_parallel_duration;
Branch: 1 branch
BranchTrueFalseTotal
$has_dependencies ? : 2 12 14
479  
480 # Factor in matrix multiplier
481 14 my $matrix_factor = estimate_matrix_factor($workflow);
482  
483 14 ▶ return int($estimated * $matrix_factor) || 5;
Condition100%2/2
int $estimated * $matrix_factor || 5
l!l
122
MC/DC100%1/1
int $estimated * $matrix_factor || 5
int $estimated * $matrix_factor
Truth table100%2/2
A
A= int $estimated * $matrix_factor
Aresult
11
00
484 }
485  
486 30 ▶sub estimate_job_duration($job) {
Subroutine estimate_job_duration: called CC=13 SCAR=25.6
Pod undocumented
487 30 ▶ my $steps = $job->{steps} or return 3;
Branch: 1 branch
BranchTrueFalseTotal
my $steps = $job->{"steps"} or return 3 28 2 30
488  
489 28 my $duration = 0;
490  
491 28 for my $step (@$steps) {
492 # Estimate based on step type
493 50 ▶ if ($step->{uses}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($step->{'uses'}) { } 16 34 50
elsif ($step->{'run'}) { } 31 3 34
494 16 my $uses = $step->{uses};
495  
496 # Common actions and their typical durations
497 16 ▶ if ($uses =~ /checkout/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($uses =~ /checkout/u) { } 11 5 16
elsif ($uses =~ /setup-(?:node|python|go|ruby)/u) { } 3 2 5
elsif ($uses =~ /cache/u) { } 1 1 2
498 11 $duration += 0.5;
499 }
500 elsif ($uses =~ /setup-(?:node|python|go|ruby)/) {
501 3 $duration += 1;
502 }
503 elsif ($uses =~ /cache/) {
504 # Cache hit: ~10s, miss: ~30s
505 1 $duration += 0.3;
506 }
507 }
508 elsif ($step->{run}) {
509 31 my $run = $step->{run};
510  
511 # Estimate based on command
512 31 ▶ if ($run =~ /npm (?:install|ci)/) {
Branch: 4 branches
BranchTrueFalseTotal
if ($run =~ /npm (?:install|ci)/u) { } 12 19 31
elsif ($run =~ /pip install/u) { } 1 18 19
elsif ($run =~ /cargo build/u) { } 6 12 18
elsif ($run =~ /(?:npm|pytest|cargo|go) test/u) { } 9 3 12
513 12 $duration += 2; # npm install takes time
514 }
515 elsif ($run =~ /pip install/) {
516 1 $duration += 1.5;
517 }
518 elsif ($run =~ /cargo build/) {
519 6 $duration += 5; # Rust builds are slow
520 }
521 elsif ($run =~ /(?:npm|pytest|cargo|go) test/) {
522 9 $duration += 2; # Test suites
523 }
524 else {
525 3 $duration += 0.5; # Generic command
526 }
527 }
528 }
529  
530 28 ▶ return $duration || 3;
Condition100%2/2
$duration || 3
l!l
262
MC/DC100%1/1
$duration || 3
$duration
Truth table100%2/2
A
A= $duration
Aresult
11
00
531 }
532  
533 20 ▶sub estimate_matrix_factor($workflow) {
Subroutine estimate_matrix_factor: called CC=10 SCAR=23.1
Pod undocumented
534 20 ▶ my $jobs = $workflow->{jobs} or return 1;
Branch: 1 branch
BranchTrueFalseTotal
my $jobs = $workflow->{"jobs"} or return 1 20 0 20
535  
536 20 my $max_matrix_size = 1;
537  
538 20 for my $job (values %$jobs) {
539 25 ▶ next unless $job->{strategy};
Branch: 1 branch
BranchTrueFalseTotal
unless $job->{"strategy"} 17 8 25
540 8 ▶ next unless $job->{strategy}->{matrix};
Branch: 1 branch
BranchTrueFalseTotal
unless $job->{"strategy"}{"matrix"} 0 8 8
541  
542 8 my $matrix = $job->{strategy}->{matrix};
543 8 my $size = 1;
544  
545 # Calculate matrix size
546 8 for my $key (keys %$matrix) {
547 13 ▶ next if $key eq 'include' || $key eq 'exclude';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "include" or $key eq "exclude" 3 10 13
Condition100%3/3
$key eq "include" or $key eq "exclude"
l!l&&r!l&&!r
2110
MC/DC100%2/2
$key eq "include" or $key eq "exclude"
$key eq "include" $key eq "exclude"
Truth table100%3/3
A or B
A= $key eq "include"B= $key eq "exclude"
ABresult
1X1
011
000
548 10 my $values = $matrix->{$key};
549 10 ▶ if (ref $values eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $values eq "ARRAY") 9 1 10
550 9 $size *= scalar @$values;
551 }
552 }
553  
554 8 ▶ $max_matrix_size = $size if $size > $max_matrix_size;
Branch: 1 branch
BranchTrueFalseTotal
if $size > $max_matrix_size 6 2 8
555 }
556  
557 20 return $max_matrix_size;
558 }
559  
560 =head1 AUTHOR
561  
562 Nigel Horne E<lt>njh@nigelhorne.comE<gt>
563  
564 L<https://github.com/nigelhorne>
565  
566 =head1 LICENSE
567  
568 This is free software; you can redistribute it and/or modify it under
569 the same terms as the Perl 5 programming language system itself.
570  
571 =cut
572  
573 64 1;
« lib/App/GHGen/Detector.pm ↑ Summary blib/lib/App/GHGen/Reporter.pm »