line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Remove unused variables |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding UTF-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
This nitpicking rules removes variabse that is declared but not used. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Moose; |
10
|
1
|
|
|
1
|
|
269359
|
use PPI::Document; |
|
1
|
|
|
|
|
370155
|
|
|
1
|
|
|
|
|
5
|
|
11
|
1
|
|
|
1
|
|
5896
|
use Perl::Critic::Document; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
12
|
1
|
|
|
1
|
|
572
|
use Perl::Critic::Policy::Variables::ProhibitUnusedVariables; |
|
1
|
|
|
|
|
807077
|
|
|
1
|
|
|
|
|
37
|
|
13
|
1
|
|
|
1
|
|
10
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
14
|
|
|
|
|
|
|
use App::PerlNitpick::PCPWrap; |
15
|
1
|
|
|
1
|
|
417
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
16
|
|
|
|
|
|
|
no Moose; |
17
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
18
|
|
|
|
|
|
|
my ($self, $doc) = @_; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
0
|
2770
|
my $o = App::PerlNitpick::PCPWrap->new('Perl::Critic::Policy::Variables::ProhibitUnusedVariables'); |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
8
|
my @vio = $o->violates( |
23
|
|
|
|
|
|
|
undef, |
24
|
1
|
|
|
|
|
10
|
Perl::Critic::Document->new(-source => $doc) |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
for (@vio) { |
28
|
|
|
|
|
|
|
my ($msg, $explain, $el) = @$_; |
29
|
1
|
|
|
|
|
12
|
if ($el->variables == 1) { |
30
|
1
|
|
|
|
|
17
|
$el->remove; |
31
|
1
|
50
|
|
|
|
4
|
} else { |
32
|
1
|
|
|
|
|
41
|
# TODO |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
return $doc; |
38
|
|
|
|
|
|
|
} |
39
|
1
|
|
|
|
|
51
|
|
40
|
|
|
|
|
|
|
1; |