| 1 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 15 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | package Open::This; | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 15 | our $VERSION = '0.000033'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 15 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 9 | 15 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||||||||||
| 10 | maybe_get_url_from_parsed_text | ||||||||||||||||||||||||||||||||||||||||||
| 11 | editor_args_from_parsed_text | ||||||||||||||||||||||||||||||||||||||||||
| 12 | parse_text | ||||||||||||||||||||||||||||||||||||||||||
| 13 | to_editor_args | ||||||||||||||||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 15 | use Module::Runtime qw( | |||||||||||||||||||||||||||||||||||||||||
| 17 | is_module_name | ||||||||||||||||||||||||||||||||||||||||||
| 18 | module_notional_filename | ||||||||||||||||||||||||||||||||||||||||||
| 19 | require_module | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 15 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 15 | ▶ | use Module::Util (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 15 | ▶ | use Path::Tiny qw( path ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 15 | ▶ | use Try::Tiny qw( catch try ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 15 | ▶ | use URI (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | ## no critic (Subroutines::ProhibitExplicitReturnUndef) | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | sub parse_text { | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 64 | ▶ | my $text = join q{ }, @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_text: called CC=21 SCAR=30.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 64 | ▶ | if ($text) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 64 | $text =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | # Don't fail on a trailing colon which was accidentally pasted. | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 64 | ▶ | if ($text) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 64 | $text =~ s{:\z}{}; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 64 | ▶ | return undef if !$text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 64 | my %parsed = ( original_text => $text ); | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 64 | my ( $line, $col ) = _maybe_extract_line_number( \$text ); | |||||||||||||||||||||||||||||||||||||||||
| 44 | 64 | $parsed{line_number} = $line; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 64 | ▶ | $parsed{column_number} = $col if $col; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 64 | $parsed{sub_name} = _maybe_extract_subroutine_name( \$text ); | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 64 | _maybe_filter_text( \$text ); | |||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | # Is this an actual file. | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 64 | ▶ | if ( -e path($text) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 41 | $parsed{file_name} = $text; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | elsif ( my $file_name = _maybe_git_diff_path($text) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | $parsed{file_name} = $file_name; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | elsif ( $text =~ m{^[^/]+\.go$} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 2 | my $file_name = _find_go_files($text); | |||||||||||||||||||||||||||||||||||||||||
| 59 | 2 | ▶ | $parsed{file_name} = $file_name if $file_name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 64 | ▶ | if ( !exists $parsed{file_name} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 21 | ▶ | if ( my $bin = _which($text) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | $parsed{file_name} = $bin; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | $text = $bin; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 64 | $parsed{is_module_name} = is_module_name($text); | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 64 | ▶ | if ( !$parsed{file_name} && $text =~ m{\Ahttps?://}i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $parsed{"file_name"} and $text =~ m[\Ahttps?://]i
MC/DC100%2/2
not $parsed{"file_name"} and $text =~ m[\Ahttps?://]i
not $parsed{"file_name"}
$text =~ m[\Ahttps?://]i
Truth table100%3/3
not(A) and B
A= not $parsed{"file_name"}B= $text =~ m[\Ahttps?://]i
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 4 | $parsed{file_name} = _maybe_extract_file_from_url( \$text ); | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 64 | ▶ | if ( !$parsed{file_name} && $parsed{is_module_name} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $parsed{"file_name"} and $parsed{"is_module_name"}
MC/DC100%2/2
not $parsed{"file_name"} and $parsed{"is_module_name"}
not $parsed{"file_name"}
$parsed{"is_module_name"}
Truth table100%3/3
not(A) and B
A= not $parsed{"file_name"}B= $parsed{"is_module_name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 11 | $parsed{file_name} = _maybe_find_local_file($text); | |||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | # This is a loadable module. Have this come after the local module checks | ||||||||||||||||||||||||||||||||||||||||||
| 80 | # so that we don't default to installed modules. | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 64 | ▶ | if ( !$parsed{file_name} && $parsed{is_module_name} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $parsed{"file_name"} and $parsed{"is_module_name"}
MC/DC100%2/2
not $parsed{"file_name"} and $parsed{"is_module_name"}
not $parsed{"file_name"}
$parsed{"is_module_name"}
Truth table100%3/3
not(A) and B
A= not $parsed{"file_name"}B= $parsed{"is_module_name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 4 | my $found = Module::Util::find_installed($text); | |||||||||||||||||||||||||||||||||||||||||
| 83 | 4 | ▶ | if ($found) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | $parsed{file_name} = $found; | |||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 64 | ▶ | if ( !$parsed{line_number} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | $parsed{line_number} = _maybe_extract_line_number_via_sub_name( | ||||||||||||||||||||||||||||||||||||||||||
| 90 | $parsed{file_name}, | ||||||||||||||||||||||||||||||||||||||||||
| 91 | $parsed{sub_name} | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 29 | ); | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 188 | my %return = map { $_ => $parsed{$_} } | |||||||||||||||||||||||||||||||||||||||||
| 96 | 64 | ▶ | grep { defined $parsed{$_} && $parsed{$_} ne q{} } keys %parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 64 | ▶ | return $return{file_name} ? \%return : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | sub maybe_get_url_from_parsed_text { | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | my $err; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maybe_get_url_from_parsed_text: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | try { | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | require_module('Git::Helpers'); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | catch { | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | $err = $_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | warn 'This feature requires Git::Helpers to be installed'; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $parsed = shift; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | return undef unless $parsed && $parsed->{file_name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$parsed and $parsed->{"file_name"}
MC/DC0%0/2
$parsed and $parsed->{"file_name"}
$parsed
$parsed->{"file_name"}
Truth table0%0/3
A and B
A= $parsedB= $parsed->{"file_name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $url = Git::Helpers::https_remote_url(); | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | return undef unless $url && $url->can('host'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$url and $url->can("host")
MC/DC0%0/2
$url and $url->can("host")
$url
$url->can("host")
Truth table0%0/3
A and B
A= $urlB= $url->can("host")
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $parsed->{remote_url} = $url; | |||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $clone = $url->clone; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my @parts = $clone->path_segments; | |||||||||||||||||||||||||||||||||||||||||
| 124 | push( | ||||||||||||||||||||||||||||||||||||||||||
| 125 | @parts, | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 'blob', Git::Helpers::current_branch_name(), | ||||||||||||||||||||||||||||||||||||||||||
| 127 | $parsed->{file_name} | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $clone->path( join '/', @parts ); | |||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if ( $parsed->{line_number} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $clone->fragment( 'L' . $parsed->{line_number} ); | |||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $parsed->{remote_file_url} = $clone; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | return $clone; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | sub to_editor_args { | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 36 | ▶ | return editor_args_from_parsed_text( parse_text(@_) ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_editor_args: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | sub editor_args_from_parsed_text { | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 40 | ▶ | my $parsed = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
editor_args_from_parsed_text: called CC=15 SCAR=27.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 40 | ▶ | return unless $parsed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 39 | my @args; | |||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | # kate --line 11 --column 2 filename | ||||||||||||||||||||||||||||||||||||||||||
| 149 | # idea.sh --line 11 --column 2 filename | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 39 | ▶ | if ( $ENV{EDITOR} eq 'kate' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$ENV{"EDITOR"} eq "kate" or $ENV{"EDITOR"} =~ /^(idea|rubymine|pycharm|phpstorm|webstorm|goland|rider|clion|fleet|aqua|data(grip|spell)|appcode)/i
MC/DC100%2/2
$ENV{"EDITOR"} eq "kate" or $ENV{"EDITOR"} =~ /^(idea|rubymine|pycharm|phpstorm|webstorm|goland|rider|clion|fleet|aqua|data(grip|spell)|appcode)/i
$ENV{"EDITOR"} eq "kate"
$ENV{"EDITOR"} =~ /^(idea|rubymine|pycharm|phpstorm|webstorm|goland|rider|clion|fleet|aqua|data(grip|spell)|appcode)/i
Truth table100%3/3
A or B
A= $ENV{"EDITOR"} eq "kate"B= $ENV{"EDITOR"} =~ /^(idea|rubymine|pycharm|phpstorm|webstorm|goland|rider|clion|fleet|aqua|data(grip|spell)|appcode)/i
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | || $ENV{EDITOR} | ||||||||||||||||||||||||||||||||||||||||||
| 152 | =~ /^(idea|rubymine|pycharm|phpstorm|webstorm|goland|rider|clion|fleet|aqua|data(grip|spell)|appcode)/i | ||||||||||||||||||||||||||||||||||||||||||
| 153 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 154 | push @args, '--line', $parsed->{line_number} | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 19 | ▶ | if $parsed->{line_number}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | push @args, '--column', $parsed->{column_number} | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 19 | ▶ | if $parsed->{column_number}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | # code --goto filename:11:2 | ||||||||||||||||||||||||||||||||||||||||||
| 162 | # codium --goto filename:11:2 | ||||||||||||||||||||||||||||||||||||||||||
| 163 | elsif ( $ENV{EDITOR} =~ /^cod(e|ium)/i ) { | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 6 | my $result = $parsed->{file_name}; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 6 | ▶ | if ( $parsed->{line_number} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 4 | $result .= ":" . $parsed->{line_number}; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 4 | ▶ | if ( $parsed->{column_number} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | $result .= ":" . $parsed->{column_number}; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 6 | return ( '--goto', $result ); | |||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | # See https://vi.stackexchange.com/questions/18499/can-i-open-a-file-at-an-arbitrary-line-and-column-via-the-command-line | ||||||||||||||||||||||||||||||||||||||||||
| 175 | # nvim +'call cursor(11,2)' filename | ||||||||||||||||||||||||||||||||||||||||||
| 176 | # vi +'call cursor(11,2)' filename | ||||||||||||||||||||||||||||||||||||||||||
| 177 | # vim +'call cursor(11,2)' filename | ||||||||||||||||||||||||||||||||||||||||||
| 178 | elsif ( exists $parsed->{column_number} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 2 | ▶ | if ( $ENV{EDITOR} eq 'nvim' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$ENV{"EDITOR"} eq "nvim" or $ENV{"EDITOR"} eq "vi" or $ENV{"EDITOR"} eq "vim"
$ENV{"EDITOR"} eq "nvim" or $ENV{"EDITOR"} eq "vi"
MC/DC33%1/3
$ENV{"EDITOR"} eq "nvim" or $ENV{"EDITOR"} eq "vi" or $ENV{"EDITOR"} eq "vim"
$ENV{"EDITOR"} eq "nvim"
$ENV{"EDITOR"} eq "vi"
$ENV{"EDITOR"} eq "vim"
Truth table50%2/4
A or B or C
A= $ENV{"EDITOR"} eq "nvim"B= $ENV{"EDITOR"} eq "vi"C= $ENV{"EDITOR"} eq "vim"
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | || $ENV{EDITOR} eq 'vi' | ||||||||||||||||||||||||||||||||||||||||||
| 181 | || $ENV{EDITOR} eq 'vim' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 182 | @args = sprintf( | ||||||||||||||||||||||||||||||||||||||||||
| 183 | '+call cursor(%i,%i)', | ||||||||||||||||||||||||||||||||||||||||||
| 184 | $parsed->{line_number}, | ||||||||||||||||||||||||||||||||||||||||||
| 185 | $parsed->{column_number}, | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | # nano +11,2 filename | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 2 | ▶ | if ( $ENV{EDITOR} eq 'nano' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | @args = sprintf( | ||||||||||||||||||||||||||||||||||||||||||
| 192 | '+%i,%i', | ||||||||||||||||||||||||||||||||||||||||||
| 193 | $parsed->{line_number}, | ||||||||||||||||||||||||||||||||||||||||||
| 194 | $parsed->{column_number}, | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 200 | # emacs +11 filename | ||||||||||||||||||||||||||||||||||||||||||
| 201 | # nano +11 filename | ||||||||||||||||||||||||||||||||||||||||||
| 202 | # nvim +11 filename | ||||||||||||||||||||||||||||||||||||||||||
| 203 | # pico +11 filename | ||||||||||||||||||||||||||||||||||||||||||
| 204 | # vi +11 filename | ||||||||||||||||||||||||||||||||||||||||||
| 205 | # vim +11 filename | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 12 | ▶ | push @args, '+' . $parsed->{line_number} if $parsed->{line_number}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 33 | return ( @args, $parsed->{file_name} ); | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | sub _maybe_extract_line_number { | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 75 | ▶ | my $text = shift; # scalar ref | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybe_extract_line_number: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | # Ansible: ": line 14, column 16," | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 75 | ▶ | if ( $$text =~ s{ line (\d+).*, column (\d+).*}{} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 4 | return $1, $2; | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | # Find a line number | ||||||||||||||||||||||||||||||||||||||||||
| 221 | # lib/Foo/Bar.pm line 222. | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 71 | ▶ | if ( $$text =~ s{ line (\d+).*}{} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 11 | return $1; | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | # mvn test output | ||||||||||||||||||||||||||||||||||||||||||
| 228 | # lib/Open/This.pm:[17,3] | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 60 | ▶ | if ( $$text =~ s{ (\w) : \[ (\d+) , (\d+) \] }{$1}x ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | return $2, $3; | |||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | # ripgrep (rg --vimgrep) | ||||||||||||||||||||||||||||||||||||||||||
| 234 | # ./lib/Open/This.pm:17:3 | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 59 | ▶ | if ( $$text =~ s{(\w):(\d+):(\d+).*}{$1} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 11 | return $2, $3; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | # git-grep (don't match on ::) | ||||||||||||||||||||||||||||||||||||||||||
| 240 | # lib/Open/This.pm:17 | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 48 | ▶ | if ( $$text =~ s{(\w):(\d+)\b}{$1} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | 12 | return $2; | |||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | # Github links: foo/bar.go#L100 | ||||||||||||||||||||||||||||||||||||||||||
| 246 | # Github links: foo/bar.go#L100-L110 | ||||||||||||||||||||||||||||||||||||||||||
| 247 | # In this case, discard everything after the matching line number as well. | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 36 | ▶ | if ( $$text =~ s{(\w)#L(\d+)\b.*}{$1} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 5 | return $2; | |||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | # git-grep contextual match | ||||||||||||||||||||||||||||||||||||||||||
| 253 | # lib/Open/This.pm-17- | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 31 | ▶ | if ( $$text =~ s{(\w)-(\d+)\-{0,1}\z}{$1} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 2 | return $2; | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 29 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | sub _maybe_filter_text { | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 64 | ▶ | my $text = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybe_filter_text: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | # Ansible: The error appears to be in '/path/to/file': | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 64 | ▶ | if ( $$text =~ m{'(.*)'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 4 | my $maybe_file = $1; | |||||||||||||||||||||||||||||||||||||||||
| 267 | 4 | ▶ | $$text = $maybe_file if -e $maybe_file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | sub _maybe_extract_subroutine_name { | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 68 | ▶ | my $text = shift; # scalar ref | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybe_extract_subroutine_name: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 68 | ▶ | if ( $$text =~ s{::(\w+)\(.*\)}{} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 9 | return $1; | |||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 59 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | sub _maybe_extract_line_number_via_sub_name { | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 29 | ▶ | my $file_name = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybe_extract_line_number_via_sub_name: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 29 | my $sub_name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 29 | ▶ | if ( $file_name && $sub_name && open( my $fh, '<', $file_name ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$file_name and $sub_name and open my $fh, "<", $file_name
$file_name and $sub_name
MC/DC66%2/3
$file_name and $sub_name and open my $fh, "<", $file_name
$file_name
$sub_name
open my $fh, "<", $file_name
Truth table75%3/4
A and B and C
A= $file_nameB= $sub_nameC= open my $fh, "<", $file_name
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 5 | my $line_number = 1; | |||||||||||||||||||||||||||||||||||||||||
| 286 | 5 | ▶ | while ( my $line = <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 21 | ▶ | if ( $line =~ m{sub $sub_name\b} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 5 | return $line_number; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 16 | ++$line_number; | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | sub _maybe_extract_file_from_url { | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 4 | ▶ | my $text = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybe_extract_file_from_url: called CC=6 SCAR=19.1
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 4 | require_module('URI'); | |||||||||||||||||||||||||||||||||||||||||
| 299 | 4 | my $uri = URI->new($$text); | |||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 4 | my @parts = $uri->path_segments; | |||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | # Is this a GitHub(ish) URL? | ||||||||||||||||||||||||||||||||||||||||||
| 304 | 4 | ▶ | if ( $parts[3] eq 'blob' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 4 | my $file = path( @parts[ 5 .. scalar @parts - 1 ] ); | |||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 4 | ▶ | return unless $file->is_file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 4 | $file = $file->stringify; | |||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 4 | ▶ | if ( $uri->fragment && $uri->fragment =~ m{\A[\d]\z} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$uri->fragment and $uri->fragment =~ /\A[\d]\z/
MC/DC0%0/2
$uri->fragment and $uri->fragment =~ /\A[\d]\z/
$uri->fragment
$uri->fragment =~ /\A[\d]\z/
Truth table66%2/3
A and B
A= $uri->fragmentB= $uri->fragment =~ /\A[\d]\z/
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | $file .= ':' . $uri->fragment; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 4 | ▶ | return $file if $file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | sub _maybe_find_local_file { | ||||||||||||||||||||||||||||||||||||||||||
| 319 | 13 | ▶ | my $text = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybe_find_local_file: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 13 | my $possible_name = module_notional_filename($text); | |||||||||||||||||||||||||||||||||||||||||
| 321 | my @dirs | ||||||||||||||||||||||||||||||||||||||||||
| 322 | = exists $ENV{OPEN_THIS_LIBS} | ||||||||||||||||||||||||||||||||||||||||||
| 323 | ? split m{,}, $ENV{OPEN_THIS_LIBS} | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 13 | ▶ | : ( 'lib', 't/lib' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 13 | for my $dir (@dirs) { | |||||||||||||||||||||||||||||||||||||||||
| 327 | 21 | my $path = path( $dir, $possible_name ); | |||||||||||||||||||||||||||||||||||||||||
| 328 | 21 | ▶ | if ( $path->is_file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 9 | return "$path"; | |||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 4 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | sub _maybe_git_diff_path { | ||||||||||||||||||||||||||||||||||||||||||
| 336 | 23 | ▶ | my $file_name = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_maybe_git_diff_path: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 23 | ▶ | if ( $file_name =~ m|^[ab]/(.+)$| ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 3 | ▶ | if ( -e path($1) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | return $1; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | 22 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | # search for binaries in path | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | sub _which { | ||||||||||||||||||||||||||||||||||||||||||
| 350 | 24 | ▶ | my $maybe_file = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_which: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 24 | ▶ | return unless $maybe_file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 24 | require_module('File::Spec'); | |||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | # we only want binary names here -- no paths | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 24 | my ( $volume, $dir, $file ) = File::Spec->splitpath($maybe_file); | |||||||||||||||||||||||||||||||||||||||||
| 357 | 24 | ▶ | return if $dir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 15 | my @path = File::Spec->path; | |||||||||||||||||||||||||||||||||||||||||
| 360 | 15 | for my $path (@path) { | |||||||||||||||||||||||||||||||||||||||||
| 361 | 107 | my $abs = path( $path, $file ); | |||||||||||||||||||||||||||||||||||||||||
| 362 | 107 | ▶ | return $abs->stringify if $abs->is_file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 13 | return; | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | sub _find_go_files { | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 3 | ▶ | my $text = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_go_files: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 3 | ▶ | my $threshold_init = shift || 5000; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 5000
MC/DC100%1/1
shift() || 5000
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 3 | my $file_name; | |||||||||||||||||||||||||||||||||||||||||
| 373 | 3 | my $iter = path('.')->iterator( { recurse => 1 } ); | |||||||||||||||||||||||||||||||||||||||||
| 374 | 3 | my $threshold = $threshold_init; | |||||||||||||||||||||||||||||||||||||||||
| 375 | 3 | ▶ | while ( my $path = $iter->() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 277 | ▶ | next unless $path->is_file; # dirs will never match anything | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 191 | ▶ | ( $threshold, $file_name ) = ( 0, "$path" ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | if $path->basename eq $text; | ||||||||||||||||||||||||||||||||||||||||||
| 379 | 191 | ▶ | last if --$threshold == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 3 | ▶ | if ( $threshold == 0 && !$file_name ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$threshold == 0 and not $file_name
MC/DC50%1/2
$threshold == 0 and not $file_name
$threshold == 0
not $file_name
Truth table66%2/3
A and not(B)
A= $threshold == 0B= not $file_name
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 1 | warn "Only $threshold_init files searched recursively"; | |||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 3 | return $file_name; | |||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | # ABSTRACT: Try to Do the Right Thing when opening files | ||||||||||||||||||||||||||||||||||||||||||
| 388 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | __END__ | ||||||||||||||||||||||||||||||||||||||||||