lib/Perl/ToPerl6/Transformer/PostfixExpressions/AddWhitespace.pm

filter: Statementstmt 90.6% 29 / 32 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.3% 12 / 13 Podpod 60.0% 3 / 5 totaltotal 88.4% 46 / 52 CC 2 SCAR 1.9
CC
2
Cov
91%
__ANON__
2.0
transform
2.0
BEGIN
1.0
CRAP 1.2
« lib/Perl/ToPerl6/TransformerParameter/Behavior/String.pm ↑ Summary lib/Perl/ToPerl6/TransformerListing.pm »
1 package Perl::ToPerl6::Transformer::PostfixExpressions::AddWhitespace;
2  
3 17 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 17 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 17 ▶use Perl::ToPerl6::Utils qw{ :severities };
Subroutine BEGIN: called CC=1 SCAR=0.0
9 17 ▶use Perl::ToPerl6::Utils::PPI qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
10 is_ppi_token_word
11 insert_trailing_whitespace
12 17 };
13  
14 17 ▶use base 'Perl::ToPerl6::Transformer';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 #-----------------------------------------------------------------------------
17  
18 17 Readonly::Scalar my $DESC => q{Transform 'if()' to 'if ()'};
19 17 Readonly::Scalar my $EXPL =>
20 q{if(), elsif() and unless() need whitespace in order to not be interpreted as function calls};
21  
22 #-----------------------------------------------------------------------------
23  
24 17 my %map = (
25 if => 1,
26 elsif => 1,
27 unless => 1,
28 while => 1,
29 until => 1,
30 for => 1,
31 foreach => 1,
32 );
33  
34 #-----------------------------------------------------------------------------
35  
36 38 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
37 26 ▶sub default_necessity { return $NECESSITY_HIGHEST }
Subroutine default_necessity: called CC=1 SCAR=0.0
Pod documented
38 24 ▶sub default_themes { return qw( core ) }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
39 5 ▶sub applies_to {
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
40 78 ▶ return sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
41 78 ▶ is_ppi_token_word($_[1],%map) and
Branch: 1 branch
BranchTrueFalseTotal
is_ppi_token_word($_[1], %map) and $_[1]->next_sibling->isa("PPI::Structure::Condition") 2 76 78
42 $_[1]->next_sibling->isa('PPI::Structure::Condition')
43 }
44 5 }
45  
46 #-----------------------------------------------------------------------------
47  
48 0 ▶sub transform {
Subroutine transform: not called CC=1 SCAR=6.9
Pod undocumented
49 0 my ($self, $elem, $doc) = @_;
50  
51 0 insert_trailing_whitespace($elem);
52  
53 0 return $self->transformation( $DESC, $EXPL, $elem );
54 }
55  
56 17 1;
57  
58 #-----------------------------------------------------------------------------
59  
60 __END__
« lib/Perl/ToPerl6/TransformerParameter/Behavior/String.pm ↑ Summary lib/Perl/ToPerl6/TransformerListing.pm »