| 1 | package Test::SpellCheck::Plugin::Perl; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 1 | ▶ | use 5.026; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 1 | ▶ | use Module::Load qw( load ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 1 | ▶ | use Test::SpellCheck::Plugin::PerlPOD; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 1 | ▶ | use Test::SpellCheck::Plugin::PerlWords; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | ▶ | use base qw( Test::SpellCheck::Plugin::Combo ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 1 | ▶ | use Carp qw( croak ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 1 | ▶ | use PerlX::Maybe; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 1 | ▶ | use Ref::Util qw( is_plain_arrayref ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 1 | ▶ | use experimental qw( signatures ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 1 | our @CARP_NOT = qw( Test::SpellCheck ); | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | # ABSTRACT: Test::SpellCheck plugin for checking spelling in Perl source | ||||||||||||||||||||
| 18 | 1 | our $VERSION = '0.02'; # VERSION | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 6 | ▶ | sub new ($class, %args) | ||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 22 | { | ||||||||||||||||||||
| 23 | 6 | my $lang_class; | |||||||||||||||||||
| 24 | my @lang_args; | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 6 | ▶ | if(defined $args{lang}) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | { | ||||||||||||||||||||
| 28 | 3 | ▶ | if(is_plain_arrayref $args{lang}) | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 29 | { | ||||||||||||||||||||
| 30 | 1 | $lang_class = 'Test::SpellCheck::Plugin::PrimaryDictionary'; | |||||||||||||||||||
| 31 | 1 | my($affix, $dic) = $args{lang}->@*; | |||||||||||||||||||
| 32 | 1 | @lang_args = (affix => $affix, dictionary => $dic); | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | elsif($args{lang} =~ /^([a-z]{2})-([a-z]{2})$/i) | ||||||||||||||||||||
| 35 | { | ||||||||||||||||||||
| 36 | 1 | $lang_class = join '::', 'Test::SpellCheck::Plugin::Lang', uc $1, uc $2; | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | else | ||||||||||||||||||||
| 39 | { | ||||||||||||||||||||
| 40 | 1 | croak "bad language: $args{lang}"; | |||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | else | ||||||||||||||||||||
| 44 | { | ||||||||||||||||||||
| 45 | 3 | $lang_class = 'Test::SpellCheck::Plugin::Lang::EN::US'; | |||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 5 | load $lang_class; | |||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | my @plugins = ( | ||||||||||||||||||||
| 51 | $lang_class->new(@lang_args), | ||||||||||||||||||||
| 52 | Test::SpellCheck::Plugin::PerlWords->new, | ||||||||||||||||||||
| 53 | Test::SpellCheck::Plugin::PerlPOD->new( | ||||||||||||||||||||
| 54 | maybe skip_sections => $args{skip_sections}, | ||||||||||||||||||||
| 55 | 5 | ), | |||||||||||||||||||
| 56 | ); | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 5 | ▶ | if($args{check_comments} // 1) | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$args{"check_comments"} // 1
MC/DC100%1/1
$args{"check_comments"} // 1
$args{"check_comments"}
Truth table100%2/2
A
A= $args{"check_comments"}
| |||||||||||||||||||||
| 59 | { | ||||||||||||||||||||
| 60 | 4 | require Test::SpellCheck::Plugin::PerlComment; | |||||||||||||||||||
| 61 | 4 | push @plugins, Test::SpellCheck::Plugin::PerlComment->new; | |||||||||||||||||||
| 62 | } | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | 5 | $class->SUPER::new(@plugins); | |||||||||||||||||||
| 65 | } | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | 1 | 1; | |||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | __END__ | ||||||||||||||||||||