| 1 | package Claude::Agent::Code::Review::Options; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use 5.020; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Object::Proto (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Claude::Agent::Code::Review::Types; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 4 | my @VALID_SEVERITIES = @Claude::Agent::Code::Review::Types::SEVERITIES; | |||||||||||||||||||||||||||
| 11 | 4 | my @VALID_CATEGORIES = @Claude::Agent::Code::Review::Types::CATEGORIES; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 4 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 4 | Object::Proto::define('Claude::Agent::Code::Review::Options', | |||||||||||||||||||||||||||
| 15 | 'categories:ArrayRef:builder(_build_categories)', | ||||||||||||||||||||||||||||
| 16 | 'severity:Str:default(low)', | ||||||||||||||||||||||||||||
| 17 | 'max_issues:Int:default(0)', | ||||||||||||||||||||||||||||
| 18 | 'output_format:Str:default(structured)', | ||||||||||||||||||||||||||||
| 19 | 'include_suggestions:Bool:default(1)', | ||||||||||||||||||||||||||||
| 20 | 'include_code_context:Bool:default(1)', | ||||||||||||||||||||||||||||
| 21 | 'language', | ||||||||||||||||||||||||||||
| 22 | 'ignore_patterns:ArrayRef:default([])', | ||||||||||||||||||||||||||||
| 23 | 'focus_areas:ArrayRef:default([])', | ||||||||||||||||||||||||||||
| 24 | 'model', | ||||||||||||||||||||||||||||
| 25 | 'effort:Str:predicate', | ||||||||||||||||||||||||||||
| 26 | 'permission_mode:Str:default(default)', | ||||||||||||||||||||||||||||
| 27 | 'perlcritic', | ||||||||||||||||||||||||||||
| 28 | 'perlcritic_severity:Int:default(4)', | ||||||||||||||||||||||||||||
| 29 | 'perlcritic_profile', | ||||||||||||||||||||||||||||
| 30 | 'filter_false_positives:Bool:default(1)', | ||||||||||||||||||||||||||||
| 31 | 'custom_filters:ArrayRef:default([])', | ||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 13 | ▶ | sub _build_categories { | ||||||||||||||||||||||||||
|
Subroutine
_build_categories: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 36 | 13 | return [@Claude::Agent::Code::Review::Types::CATEGORIES]; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 19 | ▶ | sub BUILD { | ||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=15 SCAR=27.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 19 | my ($self) = @_; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 19 | ▶ | if (defined $self->severity) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 19 | my $sev = $self->severity; | |||||||||||||||||||||||||||
| 44 | 19 | ▶ | unless (grep { $_ eq $sev } @VALID_SEVERITIES) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 1 | die "Invalid severity '$sev'. Must be one of: " . join(', ', @VALID_SEVERITIES); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 18 | ▶ | if (defined $self->categories) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 18 | ▶ | unless (ref $self->categories eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | die "Categories must be an array reference"; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | 18 | ▶ | unless (@{$self->categories}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 1 | die "Categories cannot be empty. Must specify at least one of: " . join(', ', @VALID_CATEGORIES); | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | 17 | my %seen; | |||||||||||||||||||||||||||
| 57 | 17 | for my $cat (@{$self->categories}) { | |||||||||||||||||||||||||||
| 58 | 68 | ▶ | unless (grep { $_ eq $cat } @VALID_CATEGORIES) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 1 | die "Invalid category '$cat'. Must be one of: " . join(', ', @VALID_CATEGORIES); | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | 67 | ▶ | die "Duplicate category '$cat'" if $seen{$cat}++; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 16 | ▶ | if (defined $self->max_issues && $self->max_issues < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $self->max_issues and $self->max_issues < 0
MC/DC50%1/2
defined $self->max_issues and $self->max_issues < 0
defined $self->max_issues
$self->max_issues < 0
Truth table66%2/3
A and B
A= defined $self->max_issuesB= $self->max_issues < 0
| |||||||||||||||||||||||||||||
| 66 | 1 | die "max_issues must be >= 0"; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 15 | ▶ | if (defined $self->output_format) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 15 | ▶ | unless ($self->output_format =~ /^(structured|text)$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 1 | die "Invalid output_format. Must be 'structured' or 'text'"; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 14 | ▶ | if (defined $self->perlcritic_severity) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | 14 | my $sev = $self->perlcritic_severity; | |||||||||||||||||||||||||||
| 77 | 14 | ▶ | unless ($sev =~ /^[1-5]$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 2 | die "Invalid perlcritic_severity '$sev'. Must be 1-5 (1=brutal, 5=gentle)"; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 7 | ▶ | sub has_focus_areas { | ||||||||||||||||||||||||||
|
Subroutine
has_focus_areas: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 84 | 7 | my ($self) = @_; | |||||||||||||||||||||||||||
| 85 | 7 | ▶ | return $self->focus_areas && @{$self->focus_areas} > 0; | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->focus_areas && @{$self->focus_areas;} > 0
MC/DC50%1/2
$self->focus_areas && @{$self->focus_areas;} > 0
$self->focus_areas
@{$self->focus_areas;} > 0
Truth table66%2/3
A && B
A= $self->focus_areasB= @{$self->focus_areas;} > 0
| |||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 2 | ▶ | sub has_max_issues { | ||||||||||||||||||||||||||
|
Subroutine
has_max_issues: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 90 | 2 | ▶ | return defined $self->max_issues && $self->max_issues > 0; | ||||||||||||||||||||||||||
|
Condition66%2/3
defined $self->max_issues && $self->max_issues > 0
MC/DC50%1/2
defined $self->max_issues && $self->max_issues > 0
defined $self->max_issues
$self->max_issues > 0
Truth table66%2/3
A && B
A= defined $self->max_issuesB= $self->max_issues > 0
| |||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 2 | ▶ | sub has_ignore_patterns { | ||||||||||||||||||||||||||
|
Subroutine
has_ignore_patterns: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 94 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 95 | 2 | ▶ | return $self->ignore_patterns && @{$self->ignore_patterns} > 0; | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->ignore_patterns && @{$self->ignore_patterns;} > 0
MC/DC50%1/2
$self->ignore_patterns && @{$self->ignore_patterns;} > 0
$self->ignore_patterns
@{$self->ignore_patterns;} > 0
Truth table66%2/3
A && B
A= $self->ignore_patternsB= @{$self->ignore_patterns;} > 0
| |||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 2 | ▶ | sub has_perlcritic { | ||||||||||||||||||||||||||
|
Subroutine
has_perlcritic: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 99 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 100 | 2 | ▶ | return defined $self->perlcritic && $self->perlcritic; | ||||||||||||||||||||||||||
|
Condition66%2/3
defined $self->perlcritic && $self->perlcritic
MC/DC50%1/2
defined $self->perlcritic && $self->perlcritic
defined $self->perlcritic
$self->perlcritic
Truth table66%2/3
A && B
A= defined $self->perlcriticB= $self->perlcritic
| |||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 4 | 1; | |||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | __END__ | ||||||||||||||||||||||||||||