| 1 | 1 | ▶ | use v5.12; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | package Kephra::App::Editor::Tool; | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | package Kephra::App::Editor; | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | sub insert_brace { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_brace: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | my ($self, $left, $right) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | my ($start_pos, $end_pos) = $self->GetSelection; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | if ($start_pos == $end_pos) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | $self->InsertText( $start_pos, $left.$right ); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | $self->SetSelection( $start_pos+1, $end_pos+1 ); | |||||||||||||||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||||||||||||||||
| 17 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | $self->BeginUndoAction(); | |||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | $self->InsertText( $end_pos, $right ); | |||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | $self->InsertText( $start_pos, $left ); | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | $self->SetSelection( $start_pos, $end_pos+2 ); | |||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | $self->EndUndoAction(); | |||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub toggle_comment_line { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toggle_comment_line: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my ($self, $line_nr) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | return unless defined $line_nr; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | $self->SetSelection( $self->PositionFromLine( $line_nr ), | |||||||||||||||||||||||||||||||||||||||||
| 30 | $self->GetLineEndPosition( $line_nr ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | $self->GetSelectedText( ) =~ /^(\s*)((?:#\s)|(?:#~\s))?(.*)$/; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | return unless $3; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | $2 ? $self->ReplaceSelection( $1. $3 ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | : $self->ReplaceSelection( $1.'# '.$3 ); | ||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub toggle_block_comment_line { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toggle_block_comment_line: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my ($self, $line_nr) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | return unless defined $line_nr; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $self->SetSelection( $self->PositionFromLine( $line_nr ), | |||||||||||||||||||||||||||||||||||||||||
| 41 | $self->GetLineEndPosition( $line_nr ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $self->GetSelectedText( ) =~ /^(\s*)(#?)(~\s)?(.*)$/; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | return if (not $4) or ($2 and not $3); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $4 or $2 and not $3
$2 and not $3
MC/DC0%0/3
not $4 or $2 and not $3
not $4
$2
not $3
Truth table0%0/4
not(A) or B and not(C)
A= not $4B= $2C= not $3
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | $2 ? $self->ReplaceSelection( $1. $4 ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | : $self->ReplaceSelection( $1.'#~ '.$4 ); | ||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub toggle_comment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toggle_comment: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my ($old_start, $old_end) = $self->GetSelection; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $self->BeginUndoAction(); | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | toggle_comment_line( $self, $_ ) for $self->LineFromPosition( $old_start ) .. | |||||||||||||||||||||||||||||||||||||||||
| 54 | $self->LineFromPosition( $old_end ); | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $self->GotoPos( $old_end ); | |||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $self->EndUndoAction(); | |||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub toggle_block_comment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toggle_block_comment: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my ($old_start, $old_end) = $self->GetSelection; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $self->BeginUndoAction(); | |||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | toggle_block_comment_line( $self, $_ ) for $self->LineFromPosition( $old_start ) .. | |||||||||||||||||||||||||||||||||||||||||
| 65 | $self->LineFromPosition( $old_end ); | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $self->GotoPos( $old_end ); | |||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $self->EndUndoAction(); | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||