blib/lib/PLS/Server/Request/Workspace/DidChangeWatchedFiles.pm

filter: Statementstmt 53.6% 22 / 41 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 0.0% 0 / 1 totaltotal 44.6% 29 / 65 CC 9 SCAR 38.7
CC
9
Cov
40%
service
90.0
__ANON__
2.0
BEGIN
1.0
CRAP 48.2
« blib/lib/PLS/Parser/Pod/Package.pm ↑ Summary blib/lib/PLS/Server/Response/Location.pm »
1 package PLS::Server::Request::Workspace::DidChangeWatchedFiles;
2  
3 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 13 ▶use parent 'PLS::Server::Request';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 13 ▶use List::Util qw(any uniq);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 13 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 13 ▶use PLS::Parser::Index;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 13 ▶use PLS::Server::Request::TextDocument::PublishDiagnostics;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =head1 NAME
15  
16 PLS::Server::Request::Workspace::DidChangeWatchedFiles
17  
18 =head1 DESCRIPTION
19  
20 This is a notification from the client to the server indicating
21 that one or more files that the server watched have changed.
22  
23 The server queues up these files to be re-indexed.
24  
25 =cut
26  
27 sub service
28 0 ▶{
Subroutine service: not called CC=9 SCAR=45.0
Pod undocumented
29 0 my ($self, $server) = @_;
30  
31 0 ▶ return if (ref $self->{params}{changes} ne 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"params"}{"changes"} ne "ARRAY" 0 0 0
32  
33 0 my $index = PLS::Parser::Index->new();
34  
35 0 my @changed_files;
36  
37 0 foreach my $change (@{$self->{params}{changes}})
38 {
39 0 my $file = URI->new($change->{uri});
40 0 ▶ next if (ref $file ne 'URI::file');
Branch: 1 branch
BranchTrueFalseTotal
if ref $file ne "URI::file" 0 0 0
41  
42 0 ▶ if ($change->{type} == 3)
Branch: 1 branch
BranchTrueFalseTotal
if ($change->{"type"} == 3) 0 0 0
43 {
44 0 $index->cleanup_file($file->file);
45 0 next;
46 }
47  
48 0 ▶ next if ($file->file =~ /\/\.pls-tmp-[^\/]*$/);
Branch: 1 branch
BranchTrueFalseTotal
if $file->file =~ m[/\.pls-tmp-[^/]*$] 0 0 0
49  
50 0 ▶ next unless $index->is_perl_file($file->file);
Branch: 1 branch
BranchTrueFalseTotal
unless $index->is_perl_file($file->file) 0 0 0
51 0 ▶ next if $index->is_ignored($file->file);
Branch: 1 branch
BranchTrueFalseTotal
if $index->is_ignored($file->file) 0 0 0
52  
53 0 push @changed_files, $change->{uri};
54 } ## end foreach my $change (@{$self...})
55  
56 0 @changed_files = uniq @changed_files;
57 0 ▶ $index->index_files(@changed_files)->then(sub { Future->wait_all(@_) })->retain() if (scalar @changed_files);
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if scalar @changed_files 0 0 0
58  
59 0 return;
60 } ## end sub service
61  
62 13 1;
« blib/lib/PLS/Parser/Pod/Package.pm ↑ Summary blib/lib/PLS/Server/Response/Location.pm »