StandupGenerator/Accessor.pm

filter: Statementstmt 88.0% 22 / 25 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 83.7% 31 / 37 CC 4 SCAR 10.9
CC
4
Cov
81%
open_many
4.4
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« StandupGenerator/Manipulator.pm ↑ Summary StandupGenerator/Creator.pm »
1 package StandupGenerator::Accessor;
2  
3 3 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use StandupGenerator::Helper;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 our @EXPORT = qw(
7 open_one
8 open_many
9 );
10  
11 # Open a standup file when given a full path, sprint number, and two-digit string for day
12 16 ▶sub open_one {
Subroutine open_one: called CC=1 SCAR=0.0
Pod documented
13 16 my ($path, $sprint, $day) = @_;
14 16 my $command = "open \"${path}/s${sprint}d${day}.txt\"";
15 16 system($command);
16 }
17  
18 # Open all standup files for the past week within a given directory
19 2 ▶sub open_many {
Subroutine open_many: called CC=4 SCAR=14.9
Pod documented
20 2 my ($path) = @_;
21 2 my $last_file = StandupGenerator::Helper::find_last_file($path);
22 2 my %last_file_identifiers = StandupGenerator::Helper::extract_identifiers($last_file);
23 2 my $last_file_sprint = $last_file_identifiers{'sprint'};
24 2 my $last_file_day = $last_file_identifiers{'day'};
25  
26 2 ▶ if ($last_file_day > 5) {
Branch: 1 branch
BranchTrueFalseTotal
if ($last_file_day > 5) { } 0 2 2
27 # All days will fall within the current sprint
28 0 ▶ for (my $i = 4; $i <= 9; $i = $i + 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= 9) 0 0 0
29 0 my $new_day = "0${i}";
30 0 open_one($path, $last_file_sprint, $new_day);
31 }
32 } else {
33 # Since a new sprint has just begun, days will be split between the current sprint and the previous sprint
34 2 open_one($path, $last_file_sprint - 1, '09');
35 2 open_one($path, $last_file_sprint - 1, '10');
36  
37 2 ▶ for (my $i = 1; $i <= 4; $i = $i + 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= 4) 8 2 10
38 8 my $new_day = "0${i}";
39 8 open_one($path, $last_file_sprint, $new_day);
40 }
41 }
42 }
43  
44 3 1;
45  
46 __END__
« StandupGenerator/Manipulator.pm ↑ Summary StandupGenerator/Creator.pm »