SpellCheck/Plugin/PerlComment.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 2 / 2 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 8 / 8 Podpod 50.0% 1 / 2 totaltotal 89.5% 43 / 48 CC 6 SCAR 12.1
CC
6
Cov
94%
stream
6.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.3
« SpellCheck/Plugin/Combo.pm ↑ Summary SpellCheck/Plugin/StopWords.pm »
1 package Test::SpellCheck::Plugin::PerlComment;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use 5.026;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use PPI;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use experimental qw( signatures );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # ABSTRACT: Test::SpellCheck plugin for checking spelling in Perl comments
11 2 our $VERSION = '0.02'; # VERSION
12  
13  
14 7 ▶sub new ($class)
Subroutine new: called CC=1 SCAR=0.0
Pod documented
15 {
16 7 bless {}, $class;
17 }
18  
19 5 ▶sub stream ($self, $filename, $splitter, $callback)
Subroutine stream: called CC=6 SCAR=18.1
Pod undocumented
20 {
21 5 my $doc = PPI::Document->new($filename);
22 5 ▶ foreach my $comment (($doc->find('PPI::Token::Comment') || [])->@*)
Condition50%1/2
$doc->find('PPI::Token::Comment') || []
l!l
50
MC/DC0%0/1
$doc->find('PPI::Token::Comment') || []
$doc->find('PPI::Token::Comment')
Truth table50%1/2
A
A= $doc->find('PPI::Token::Comment')
Aresult
11
00
23 {
24 16 ▶ next if $comment->location->[0] == 1 &&
Branch: 1 branch
BranchTrueFalseTotal
if $comment->location->[0] == 1 and "$comment" =~ /^#!/u 5 11 16
Condition66%2/3
$comment->location->[0] == 1 and "$comment" =~ /^#!/u
!ll&&!rl&&r
1105
MC/DC50%1/2
$comment->location->[0] == 1 and "$comment" =~ /^#!/u
$comment->location->[0] == 1 "$comment" =~ /^#!/u
Truth table66%2/3
A and B
A= $comment->location->[0] == 1B= "$comment" =~ /^#!/u
ABresult
0X0
100
111
25 "$comment" =~ /^#!/;
26 11 foreach my $event ($splitter->split("$comment"))
27 {
28 11 my($type, $word) = @$event;
29 11 my @row = ( $type, "$filename", $comment->location->[0], $word );
30 11 $callback->(@row);
31 }
32 }
33 5 return $self;
34 }
35  
36 2 1;
37  
38 __END__
« SpellCheck/Plugin/Combo.pm ↑ Summary SpellCheck/Plugin/StopWords.pm »