File Coverage

blib/lib/Perl/Critic/TooMuchCode.pm
Criterion Covered Total %
statement 12 12 100.0
branch 6 6 100.0
condition n/a
subroutine 3 3 100.0
pod n/a
total 21 21 100.0


line stmt bran cond sub pod time code
1             package Perl::Critic::TooMuchCode;
2 5     5   688 use strict;
  5         13  
  5         1108  
3             our $VERSION='0.17';
4              
5             # Well, we need a place for this monkey-patching business.
6             sub __get_terop_usage {
7 24     24   76 my ($used, $doc) = @_;
8 24 100   733   61 for my $question_mark (@{ $doc->find( sub { $_[1]->isa('PPI::Token::Operator') && $_[1]->content eq '?' }) ||[]}) {
  24 100       272  
  733         8410  
9 4         49 my $el = $question_mark->snext_sibling;
10 4 100       270 next unless $el->isa('PPI::Token::Label');
11              
12 3         12 my $tok = $el->content;
13 3         38 $tok =~ s/\s*:\z//;
14              
15 3         13 $used->{$tok}++;
16             }
17             }
18              
19             1;
20             __END__
21              
22             =head1 NAME
23              
24             Perl::Critic::TooMuchCode - perlcritic add-ons that generally check for dead code.
25              
26             =head1 DESCRIPTION
27              
28             This add-on for L<Perl::Critic> is aiming for identifying trivial dead
29             code. Either the ones that has no use, or the one that produce no
30             effect. Having dead code floating around causes maintenance burden. Some
31             might prefer not to generate them in the first place.
32              
33             =head1 AUTHOR
34              
35             Kang-min Liu <gugod@gugod.org>
36              
37             =head1 LICENSE
38              
39             MIT
40              
41             =cut