line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::PerlNitpick::Rule::RemoveUnusedVariables; |
2
|
1
|
|
|
1
|
|
365278
|
use Moose; |
|
1
|
|
|
|
|
467920
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
8050
|
use PPI::Document; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
800
|
use Perl::Critic::Document; |
|
1
|
|
|
|
|
1412091
|
|
|
1
|
|
|
|
|
86
|
|
5
|
1
|
|
|
1
|
|
12
|
use Perl::Critic::Policy::Variables::ProhibitUnusedVariables; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
499
|
use App::PerlNitpick::PCPWrap; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
31
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7
|
no Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
16
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub rewrite { |
12
|
1
|
|
|
1
|
0
|
10245
|
my ($self, $doc) = @_; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
24
|
my $o = App::PerlNitpick::PCPWrap->new('Perl::Critic::Policy::Variables::ProhibitUnusedVariables'); |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
15
|
my @vio = $o->violates( |
17
|
|
|
|
|
|
|
undef, |
18
|
|
|
|
|
|
|
Perl::Critic::Document->new(-source => $doc) |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
20
|
for (@vio) { |
22
|
1
|
|
|
|
|
39
|
my ($msg, $explain, $el) = @$_; |
23
|
1
|
50
|
|
|
|
7
|
if ($el->variables == 1) { |
24
|
1
|
|
|
|
|
56
|
$el->remove; |
25
|
|
|
|
|
|
|
} else { |
26
|
|
|
|
|
|
|
# TODO: figure out which variables in this multi-variable statement are unused. |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
75
|
return $doc; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=encoding UTF-8 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 ABSTRACT |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
All variables written in the code must be used. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |