lib/BioX/Workflow/Command/inspect/Utils/ParsePlainText.pm

filter: Statementstmt 18.8% 13 / 69 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 33.3% 3 / 9 Podpod 0.0% 0 / 5 totaltotal 14.5% 16 / 110 CC 15 SCAR 27.5
CC
15
Cov
14%
get_line_declarations
20.0
get_line_number_rules
20.0
get_line_number_rule_key
20.0
CRAP 15.7
« lib/BioX/Workflow/Command/run/Utils/Files/ResolveDeps.pm ↑ Summary lib/BioX/Workflow/Command/run/Rules/Directives/Walk.pm »
1 package BioX::Workflow::Command::inspect::Utils::ParsePlainText;
2  
3 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use File::Slurp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 has 'workflow_plain_text' => (
8 is => 'rw',
9 lazy => 1,
10 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
11 0 my $self = shift;
12 0 return read_file( $self->workflow, array_ref => 1 );
13 }
14 1 );
15  
16 1 has 'line_number_rules_dec' => (
17 is => 'rw',
18 lazy => 1,
19 default => 1,
20 );
21  
22 1 has 'line_number_global_dec' => (
23 is => 'rw',
24 lazy => 1,
25 default => 2,
26 );
27  
28 0 ▶sub get_line_declarations {
Subroutine get_line_declarations: not called CC=4 SCAR=30.0
Pod undocumented
29 0 my $self = shift;
30  
31 0 my $line_number = 0;
32 0 foreach my $line ( @{ $self->workflow_plain_text } ) {
33 0 ▶ if ( $line =~ m/\s*:\s*rules\s*:/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($line =~ /\s*:\s*rules\s*:/) { } 0 0 0
elsif ($line =~ /\s:\s*global\s:/) { } 0 0 0
34 0 my $column = $self->get_column($line);
35 $self->inspect_obj->{line_numbers}->{begin_rules} =
36 0 { line => $line_number, column => $column };
37 0 $self->line_number_rules_dec($line_number);
38 }
39 elsif ( $line =~ m/\s:\s*global\s:/ ) {
40 0 my $column = $self->get_column($line);
41 $self->inspect_obj->{line_numbers}->{begin_global} =
42 0 { line => $line_number, column => $column };
43 0 $self->line_number_global_dec($line_number);
44 }
45 0 $line_number++;
46 }
47 }
48  
49 0 ▶sub get_line_number_rules {
Subroutine get_line_number_rules: not called CC=4 SCAR=30.0
Pod undocumented
50 0 my $self = shift;
51  
52 $self->inspect_obj->{line_numbers}->{rules}->{ $self->rule_name }->{local}
53 0 = {};
54  
55 0 my $rule_name = $self->rule_name;
56 0 my $found_rule = 0;
57 0 my $found_local = 0;
58  
59 0 ▶ for (
Branch: 1 branch
BranchTrueFalseTotal
if ($x < scalar @{$self->workflow_plain_text;}) 0 0 0
60 my $x = $self->line_number_rules_dec + 1 ;
61 0 $x < scalar @{ $self->workflow_plain_text } ;
62 $x++
63 )
64 {
65 0 my $line = $self->workflow_plain_text->[$x];
66 0 ▶ if ($found_rule) {
Branch: 2 branches
BranchTrueFalseTotal
if ($found_rule) { } 0 0 0
elsif ($line =~ /\s*-\s*$rule_name\s*:/) { } 0 0 0
67 0 $self->get_line_number_rule_key( $line, $x );
68 0 $self->get_line_number_rule_process( $line, $x );
69 }
70 elsif ( ( $line =~ m/\s*-\s*$rule_name\s*:/ ) ) {
71 0 my $column = $self->get_column($line);
72 0 $self->inspect_obj->{line_numbers}->{begin_rule} = {line => $x, column => $column};
73 0 $found_rule = 1;
74 }
75 }
76 }
77  
78 0 ▶sub get_line_number_rule_process {
Subroutine get_line_number_rule_process: not called CC=3 SCAR=24.8
Pod undocumented
79 0 my $self = shift;
80 0 my $line = shift;
81 0 my $line_count = shift;
82  
83 return
84 if
85 exists $self->inspect_obj->{line_numbers}->{rules}->{ $self->rule_name }
86 0 ▶ ->{process};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->inspect_obj->{"line_numbers"}{"rules"}{$self->rule_name}{"process"} 0 0 0
87  
88 0 ▶ if ( ( $line =~ m/\s*process\s*:/ ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /\s*process\s*:/) 0 0 0
89 0 my $column = $self->get_column($line);
90 $self->inspect_obj->{line_numbers}->{rules}->{ $self->rule_name }
91 0 ->{process} = { line => $line_count, column => $column };
92 0 return;
93 }
94 }
95  
96 0 ▶sub get_line_number_rule_key {
Subroutine get_line_number_rule_key: not called CC=4 SCAR=30.0
Pod undocumented
97 0 my $self = shift;
98 0 my $line = shift;
99 0 my $line_count = shift;
100  
101 0 foreach my $key ( @{ $self->rule_keys } ) {
102 next
103 if exists $self->inspect_obj->{line_numbers}->{rules}
104 0 ▶ ->{ $self->rule_name }->{local}->{$key};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->inspect_obj->{"line_numbers"}{"rules"}{$self->rule_name}{"local"}{$key} 0 0 0
105  
106 0 ▶ if ( ( $line =~ m/\s*-\s*$key\s*:/ ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /\s*-\s*$key\s*:/) 0 0 0
107 0 my $column = $self->get_column($line);
108 $self->inspect_obj->{line_numbers}->{rules}->{ $self->rule_name }
109 0 ->{local}->{$key} = { line => $line_count, column => $column, };
110 0 return;
111 }
112 }
113 }
114  
115 0 ▶sub get_column {
Subroutine get_column: not called CC=4 SCAR=30.0
Pod undocumented
116 0 my $self = shift;
117 0 my $line = shift;
118  
119 0 my $column = 0;
120 0 my @split_line = split( '', $line );
121 0 ▶ for ( my $x = 0 ; $x <= $#split_line ; $x++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x <= $#split_line) 0 0 0
122 0 ▶ if ( $split_line[$x] =~ m/^\s*$/ || $split_line[$x] =~ m/^\t*$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($split_line[$x] =~ /^\s*$/ or $split_line[$x] =~ /^\t*$/) { } 0 0 0
Condition0%0/3
$split_line[$x] =~ /^\s*$/ or $split_line[$x] =~ /^\t*$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$split_line[$x] =~ /^\s*$/ or $split_line[$x] =~ /^\t*$/
$split_line[$x] =~ /^\s*$/ $split_line[$x] =~ /^\t*$/
Truth table0%0/3
A or B
A= $split_line[$x] =~ /^\s*$/B= $split_line[$x] =~ /^\t*$/
ABresult
1X1
011
000
123 0 $column = $x;
124 }
125 else {
126 0 last;
127 }
128 }
129 0 $column += 1;
130 ##Make these tabs
131 0 $column = $column / 4;
132 }
133 1 1;
« lib/BioX/Workflow/Command/run/Utils/Files/ResolveDeps.pm ↑ Summary lib/BioX/Workflow/Command/run/Rules/Directives/Walk.pm »