| 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') || []
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')
| |||||||||||||||||||||||||||||
| 23 | { | ||||||||||||||||||||||||||||
| 24 | 16 | ▶ | next if $comment->location->[0] == 1 && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$comment->location->[0] == 1 and "$comment" =~ /^#!/u
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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||