SpellCheck/Plugin/StopWords.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 50.0% 1 / 2 totaltotal 97.8% 45 / 46 CC 6 SCAR 12.0
CC
6
Cov
100%
new
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.3
« SpellCheck/Plugin/PerlComment.pm ↑ Summary SpellCheck/Plugin/PrimaryDictionary.pm »
1 package Test::SpellCheck::Plugin::StopWords;
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 experimental qw( signatures );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Path::Tiny qw( path );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Ref::Util qw( is_plain_arrayref );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # ABSTRACT: Test::SpellCheck plugin that adds arbitrary jargon words
11 2 our $VERSION = '0.02'; # VERSION
12  
13  
14 8 ▶sub new ($class, %args)
Subroutine new: called CC=6 SCAR=17.9
Pod documented
15 {
16 8 my %stopwords;
17  
18 8 ▶ if($args{file})
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"file"}) 3 5 8
19 {
20 3 my @words = path($args{file})->lines_utf8;
21 3 chomp @words;
22 3 $stopwords{$_} = 1 for @words;
23 }
24  
25 8 ▶ if(defined $args{word})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{"word"}) 6 2 8
26 {
27 6 ▶ if(is_plain_arrayref $args{word})
Branch: 1 branch
BranchTrueFalseTotal
if (is_plain_arrayref($args{'word'})) { } 4 2 6
28 {
29 4 $stopwords{$_} = 1 for $args{word}->@*;
30 }
31 else
32 {
33 2 $stopwords{$args{word}} = 1;
34 }
35 }
36  
37 bless {
38 8 stopwords => [sort keys %stopwords],
39 }, $class;
40 }
41  
42  
43 8 ▶sub stopwords ($self)
Subroutine stopwords: called CC=1 SCAR=0.0
Pod undocumented
44 {
45 8 return $self->{stopwords}->@*;
46 }
47  
48 2 1;
49  
50 __END__
« SpellCheck/Plugin/PerlComment.pm ↑ Summary SpellCheck/Plugin/PrimaryDictionary.pm »