| 1 | package Claude::Agent::Code::Review::Report; | ||||||||||||||||||||||||||||||||
| 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 Cpanel::JSON::XS qw(encode_json); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 4 | Object::Proto::define('Claude::Agent::Code::Review::Report', | |||||||||||||||||||||||||||||||
| 12 | 'summary:Str:required', | ||||||||||||||||||||||||||||||||
| 13 | 'issues:ArrayRef:default([])', | ||||||||||||||||||||||||||||||||
| 14 | 'metrics', | ||||||||||||||||||||||||||||||||
| 15 | 'perlcritic_issues:ArrayRef:default([])', | ||||||||||||||||||||||||||||||||
| 16 | 'perlcritic_enabled:Bool:default(0)', | ||||||||||||||||||||||||||||||||
| 17 | 'filtered_count:Int:default(0)', | ||||||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | 22 | ▶ | sub has_issues { | ||||||||||||||||||||||||||||||
|
Subroutine
has_issues: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 22 | 22 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 23 | 22 | return @{$self->issues} > 0; | |||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | sub has_critical_issues { | ||||||||||||||||||||||||||||||
|
Subroutine
has_critical_issues: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 27 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 28 | 2 | return scalar(grep { $_->severity eq 'critical' } @{$self->issues}) > 0; | |||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | sub has_high_issues { | ||||||||||||||||||||||||||||||
|
Subroutine
has_high_issues: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 32 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 33 | 2 | return scalar(grep { $_->severity eq 'high' } @{$self->issues}) > 0; | |||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | 9 | ▶ | sub issue_count { | ||||||||||||||||||||||||||||||
|
Subroutine
issue_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 37 | 9 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 38 | 9 | return scalar @{$self->issues}; | |||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | 7 | ▶ | sub generate_summary { | ||||||||||||||||||||||||||||||
|
Subroutine
generate_summary: called CC=18 SCAR=29.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 42 | 7 | my ($self_or_class, $issues_ref) = @_; | |||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | 7 | my @issues; | |||||||||||||||||||||||||||||||
| 45 | 7 | ▶ | if (ref($self_or_class) && $self_or_class->isa(__PACKAGE__)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $self_or_class and $self_or_class->isa(__PACKAGE__)
MC/DC50%1/2
ref $self_or_class and $self_or_class->isa(__PACKAGE__)
ref $self_or_class
$self_or_class->isa(__PACKAGE__)
Truth table66%2/3
A and B
A= ref $self_or_classB= $self_or_class->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||||||
| 46 | 1 | @issues = @{$self_or_class->issues}; | |||||||||||||||||||||||||||||||
| 47 | } else { | ||||||||||||||||||||||||||||||||
| 48 | 6 | ▶ | @issues = @{$issues_ref // []}; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$issues_ref // []
MC/DC0%0/1
$issues_ref // []
$issues_ref
Truth table50%1/2
A
A= $issues_ref
| |||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | 7 | my $total = scalar @issues; | |||||||||||||||||||||||||||||||
| 52 | 7 | ▶ | return "No issues found." unless $total > 0; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||
| 54 | 6 | my %by_sev; | |||||||||||||||||||||||||||||||
| 55 | 6 | for my $issue (@issues) { | |||||||||||||||||||||||||||||||
| 56 | 13 | ▶ | push @{$by_sev{$issue->severity} //= []}, $issue; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$by_sev{$issue->severity} //= []
MC/DC100%1/1
$by_sev{$issue->severity} //= []
$by_sev{$issue->severity}
Truth table100%2/2
A
A= $by_sev{$issue->severity}
| |||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | 6 | my %by_cat; | |||||||||||||||||||||||||||||||
| 60 | 6 | for my $issue (@issues) { | |||||||||||||||||||||||||||||||
| 61 | 13 | ▶ | push @{$by_cat{$issue->category} //= []}, $issue; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$by_cat{$issue->category} //= []
MC/DC100%1/1
$by_cat{$issue->category} //= []
$by_cat{$issue->category}
Truth table100%2/2
A
A= $by_cat{$issue->category}
| |||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||
| 64 | 6 | my @sev_parts; | |||||||||||||||||||||||||||||||
| 65 | 6 | for my $sev (qw(critical high medium low info)) { | |||||||||||||||||||||||||||||||
| 66 | 30 | ▶ | my $count = scalar(@{$by_sev{$sev} // []}); | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$by_sev{$sev} // []
MC/DC100%1/1
$by_sev{$sev} // []
$by_sev{$sev}
Truth table100%2/2
A
A= $by_sev{$sev}
| |||||||||||||||||||||||||||||||||
| 67 | 30 | ▶ | push @sev_parts, "$count $sev" if $count > 0; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | 6 | my @cat_parts; | |||||||||||||||||||||||||||||||
| 71 | 6 | for my $cat (qw(security bugs performance maintainability style)) { | |||||||||||||||||||||||||||||||
| 72 | 30 | ▶ | my $count = scalar(@{$by_cat{$cat} // []}); | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$by_cat{$cat} // []
MC/DC100%1/1
$by_cat{$cat} // []
$by_cat{$cat}
Truth table100%2/2
A
A= $by_cat{$cat}
| |||||||||||||||||||||||||||||||||
| 73 | 30 | ▶ | push @cat_parts, "$count $cat" if $count > 0; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | 6 | ▶ | my $summary = "Found $total issue" . ($total == 1 ? '' : 's'); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 77 | 6 | ▶ | $summary .= ": " . join(", ", @sev_parts) if @sev_parts; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 78 | 6 | ▶ | $summary .= " (" . join(", ", @cat_parts) . ")" if @cat_parts; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 79 | 6 | $summary .= "."; | |||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | 6 | return $summary; | |||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | 1 | ▶ | sub issues_by_category { | ||||||||||||||||||||||||||||||
|
Subroutine
issues_by_category: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 85 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | 1 | my %by_cat; | |||||||||||||||||||||||||||||||
| 88 | 1 | for my $issue (@{$self->issues}) { | |||||||||||||||||||||||||||||||
| 89 | 3 | ▶ | push @{$by_cat{$issue->category} //= []}, $issue; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$by_cat{$issue->category} //= []
MC/DC0%0/1
$by_cat{$issue->category} //= []
$by_cat{$issue->category}
Truth table50%1/2
A
A= $by_cat{$issue->category}
| |||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||
| 92 | 1 | return \%by_cat; | |||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||
| 95 | 4 | ▶ | sub issues_by_severity { | ||||||||||||||||||||||||||||||
|
Subroutine
issues_by_severity: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 96 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||
| 98 | 4 | my %by_sev; | |||||||||||||||||||||||||||||||
| 99 | 4 | for my $issue (@{$self->issues}) { | |||||||||||||||||||||||||||||||
| 100 | 8 | ▶ | push @{$by_sev{$issue->severity} //= []}, $issue; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$by_sev{$issue->severity} //= []
MC/DC0%0/1
$by_sev{$issue->severity} //= []
$by_sev{$issue->severity}
Truth table50%1/2
A
A= $by_sev{$issue->severity}
| |||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||
| 103 | 4 | return \%by_sev; | |||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||
| 106 | 1 | ▶ | sub issues_by_file { | ||||||||||||||||||||||||||||||
|
Subroutine
issues_by_file: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 107 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||
| 109 | 1 | my %by_file; | |||||||||||||||||||||||||||||||
| 110 | 1 | for my $issue (@{$self->issues}) { | |||||||||||||||||||||||||||||||
| 111 | 3 | ▶ | push @{$by_file{$issue->file} //= []}, $issue; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$by_file{$issue->file} //= []
MC/DC100%1/1
$by_file{$issue->file} //= []
$by_file{$issue->file}
Truth table100%2/2
A
A= $by_file{$issue->file}
| |||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||
| 114 | 1 | return \%by_file; | |||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||
| 117 | 7 | ▶ | sub as_text { | ||||||||||||||||||||||||||||||
|
Subroutine
as_text: called CC=17 SCAR=28.3
Pod
documented
| |||||||||||||||||||||||||||||||||
| 118 | 7 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||
| 120 | 7 | my @lines; | |||||||||||||||||||||||||||||||
| 121 | 7 | push @lines, "=" x 60; | |||||||||||||||||||||||||||||||
| 122 | 7 | push @lines, "CODE REVIEW REPORT"; | |||||||||||||||||||||||||||||||
| 123 | 7 | push @lines, "=" x 60; | |||||||||||||||||||||||||||||||
| 124 | 7 | push @lines, ""; | |||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||
| 126 | 7 | ▶ | if ($self->perlcritic_enabled) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 127 | 3 | my $pc_count = scalar @{$self->perlcritic_issues}; | |||||||||||||||||||||||||||||||
| 128 | 3 | ▶ | if ($pc_count == 0) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 129 | 2 | push @lines, "Perl::Critic: *** NO PERLCRITIC ERRORS ***"; | |||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||
| 131 | else { | ||||||||||||||||||||||||||||||||
| 132 | 1 | push @lines, "Perl::Critic: $pc_count issue(s) found"; | |||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||
| 134 | 3 | push @lines, ""; | |||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||
| 137 | 7 | push @lines, "Summary: " . $self->summary; | |||||||||||||||||||||||||||||||
| 138 | 7 | push @lines, "Total issues: " . $self->issue_count; | |||||||||||||||||||||||||||||||
| 139 | 7 | ▶ | if ($self->filtered_count > 0) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 140 | 1 | push @lines, "Filtered: " . $self->filtered_count . " likely false positive(s) removed"; | |||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||
| 142 | 7 | push @lines, ""; | |||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||
| 144 | 7 | ▶ | if ($self->has_issues) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 145 | 3 | my $by_sev = $self->issues_by_severity; | |||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||
| 147 | 3 | for my $severity (qw(critical high medium low info)) { | |||||||||||||||||||||||||||||||
| 148 | 15 | ▶ | my $issues = $by_sev->{$severity} // []; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$by_sev->{$severity} // []
MC/DC100%1/1
$by_sev->{$severity} // []
$by_sev->{$severity}
Truth table100%2/2
A
A= $by_sev->{$severity}
| |||||||||||||||||||||||||||||||||
| 149 | 15 | ▶ | next unless @$issues; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||
| 151 | 5 | push @lines, "-" x 40; | |||||||||||||||||||||||||||||||
| 152 | 5 | push @lines, uc($severity) . " (" . scalar(@$issues) . ")"; | |||||||||||||||||||||||||||||||
| 153 | 5 | push @lines, "-" x 40; | |||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||
| 155 | 5 | for my $issue (@$issues) { | |||||||||||||||||||||||||||||||
| 156 | 5 | push @lines, ""; | |||||||||||||||||||||||||||||||
| 157 | 5 | push @lines, sprintf("[%s] %s:%d", $issue->category, $issue->file, $issue->line); | |||||||||||||||||||||||||||||||
| 158 | 5 | push @lines, " " . $issue->description; | |||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||
| 160 | 5 | ▶ | if ($issue->has_explanation) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 161 | 1 | push @lines, " Explanation: " . $issue->explanation; | |||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||
| 164 | 5 | ▶ | if ($issue->has_suggestion) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 165 | 1 | push @lines, " Suggestion: " . $issue->suggestion; | |||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||
| 168 | 5 | ▶ | if ($issue->has_code_before && $issue->has_code_after) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$issue->has_code_before and $issue->has_code_after
MC/DC50%1/2
$issue->has_code_before and $issue->has_code_after
$issue->has_code_before
$issue->has_code_after
Truth table66%2/3
A and B
A= $issue->has_code_beforeB= $issue->has_code_after
| |||||||||||||||||||||||||||||||||
| 169 | 1 | push @lines, " Before: " . $issue->code_before; | |||||||||||||||||||||||||||||||
| 170 | 1 | push @lines, " After: " . $issue->code_after; | |||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||
| 175 | else { | ||||||||||||||||||||||||||||||||
| 176 | 4 | push @lines, "No issues found."; | |||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||
| 179 | 7 | push @lines, ""; | |||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||
| 181 | 7 | ▶ | if ($self->has_issues && !$self->perlcritic_enabled) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$self->has_issues and not $self->perlcritic_enabled
MC/DC100%2/2
$self->has_issues and not $self->perlcritic_enabled
$self->has_issues
not $self->perlcritic_enabled
Truth table100%3/3
A and not(B)
A= $self->has_issuesB= not $self->perlcritic_enabled
| |||||||||||||||||||||||||||||||||
| 182 | 2 | push @lines, "-" x 60; | |||||||||||||||||||||||||||||||
| 183 | 2 | push @lines, "Note: AI review is non-deterministic. Results may vary."; | |||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||
| 185 | ▶ | elsif ($self->has_issues && $self->perlcritic_enabled) { | |||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->has_issues and $self->perlcritic_enabled
MC/DC50%1/2
$self->has_issues and $self->perlcritic_enabled
$self->has_issues
$self->perlcritic_enabled
Truth table66%2/3
A and B
A= $self->has_issuesB= $self->perlcritic_enabled
| |||||||||||||||||||||||||||||||||
| 186 | 1 | push @lines, "-" x 60; | |||||||||||||||||||||||||||||||
| 187 | 1 | push @lines, "Note: AI issues above may vary between runs."; | |||||||||||||||||||||||||||||||
| 188 | 1 | push @lines, "Perl::Critic issues are deterministic and reproducible."; | |||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||
| 191 | 7 | push @lines, ""; | |||||||||||||||||||||||||||||||
| 192 | 7 | push @lines, "=" x 60; | |||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||
| 194 | 7 | return join("\n", @lines) . "\n"; | |||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||
| 197 | 3 | ▶ | sub as_json { | ||||||||||||||||||||||||||||||
|
Subroutine
as_json: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 198 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||
| 200 | my $data = { | ||||||||||||||||||||||||||||||||
| 201 | summary => $self->summary, | ||||||||||||||||||||||||||||||||
| 202 | issues => [ | ||||||||||||||||||||||||||||||||
| 203 | map { | ||||||||||||||||||||||||||||||||
| 204 | 5 | my $issue = $_; | |||||||||||||||||||||||||||||||
| 205 | { | ||||||||||||||||||||||||||||||||
| 206 | 5 | ▶ | severity => $issue->severity, | ||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||
| 207 | category => $issue->category, | ||||||||||||||||||||||||||||||||
| 208 | file => $issue->file, | ||||||||||||||||||||||||||||||||
| 209 | line => $issue->line, | ||||||||||||||||||||||||||||||||
| 210 | ($issue->has_end_line ? (end_line => $issue->end_line) : ()), | ||||||||||||||||||||||||||||||||
| 211 | description => $issue->description, | ||||||||||||||||||||||||||||||||
| 212 | ($issue->has_explanation ? (explanation => $issue->explanation) : ()), | ||||||||||||||||||||||||||||||||
| 213 | ($issue->has_suggestion ? (suggestion => $issue->suggestion) : ()), | ||||||||||||||||||||||||||||||||
| 214 | ($issue->has_code_before ? (code_before => $issue->code_before) : ()), | ||||||||||||||||||||||||||||||||
| 215 | ($issue->has_code_after ? (code_after => $issue->code_after) : ()), | ||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||
| 217 | 3 | ▶ | } @{$self->issues} | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 218 | ], | ||||||||||||||||||||||||||||||||
| 219 | ($self->metrics ? (metrics => $self->metrics) : ()), | ||||||||||||||||||||||||||||||||
| 220 | }; | ||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||
| 222 | 3 | return encode_json($data); | |||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||
| 225 | 2 | ▶ | sub to_hash { | ||||||||||||||||||||||||||||||
|
Subroutine
to_hash: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 226 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||
| 228 | return { | ||||||||||||||||||||||||||||||||
| 229 | summary => $self->summary, | ||||||||||||||||||||||||||||||||
| 230 | 2 | ▶ | issues => [ map { $_->to_hash } @{$self->issues} ], | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 231 | ($self->metrics ? (metrics => $self->metrics) : ()), | ||||||||||||||||||||||||||||||||
| 232 | }; | ||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||
| 236 | 4 | 1; | |||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||
| 238 | __END__ | ||||||||||||||||||||||||||||||||