Branch Coverage

script/tt
Criterion Covered Total %
branch 24 238 10.0


line true false branch
3 0 1 if (@ARGV and @ARGV[0] =~ /^\w/)
4 0 0 /^-{1,2}h\w{0,3}$/ ? :
22 0 0 @_ > 1 ? :
0 0 @_ == 1 ? :
34 0 0 unless -d $File::Find::name
35 0 0 if -d $$self
37 0 0 $cb ? :
42 0 0 unless open my $file, '<', $$self
51 0 0 unless open my $file, '>', $$self
52 0 0 unless defined $file->syswrite($content)
93 0 0 if @_ and -f $_[0]
94 0 0 if $self->year or $self->month or not -t STDIN
114 0 0 $event->{'minutes'} >= $self->config('round_up_at') ? :
122 0 0 if &blessed($val) and $val->can('ymd')
123 0 0 if ref $val eq 'ARRAY'
142 0 0 if $for eq 'app'
146 0 0 unless open my $POD, '<', $INC{'App/tt.pm'}
149 0 0 if /^=head2 $for/ ... /^=(head|cut)/
154 0 0 unless @help
179 0 0 $res->{'interval'} eq 'month' ? :
180 0 0 if @table > 3
188 0 0 if ($self->config('hours_per_month') and $res->{'interval'} eq 'month')
190 0 0 $days > 0 ? :
191 0 0 $days <= 0 ? :
202 0 0 unless $start and $stop
218 0 0 if (-e $trc_file)
223 0 0 if $self->_save(\%event)
236 0 0 if -d '.git'
238 0 0 unless $event->{'project'}
241 0 0 unless $self->_save($event)
251 0 0 if $exit_code == 3
260 0 0 if (not $event->{'start'}) { }
0 0 elsif ($event->{'stop'}) { }
280 0 0 unless ($self->{'config'})
283 0 0 unless -r $path
284 0 0 unless open my $CONFIG, '<', $path
286 0 0 unless $line =~ /^(?:TT_)?(\w+)=(.+)/
306 0 0 $trc_file ? :
309 0 0 unless $event->{'start'}
314 0 0 unless $event->{$k}
0 0 if $k eq 'tags'
315 0 0 if $k eq 'start' or $k eq 'stop' and $event->{$k}
324 0 0 unless my($k, $v) = /^(\w+)\s*:\s*(.+)/
325 0 0 if $k eq 'tags'
326 0 0 if $k eq 'start'
327 0 0 if $k eq 'stop'
331 0 0 unless $self->_save($event)
332 0 0 if $prev
333 0 0 unless $trc_file eq $event->{'path'}
340 0 0 if (ref $data eq 'ARRAY')
341 0 0 $data->[0][-1] eq '{X}' ? :
342 0 0 $PTY ? :
346 0 0 unless ref $row eq 'ARRAY'
351 0 0 if $len >= ($spec[$col] // 0)
354 0 0 if $w >= ($width // 0)
360 0 0 ref $_ ? :
367 0 0 if ($data =~ s/^(>|!)\s//)
371 0 0 if $PTY
374 0 0 if @_ == 2
393 0 0 $trc_file && -r $trc_file ? :
412 0 0 if $pl < length $p
420 0 0 ref $duration ? :
428 0 0 unless $sep
429 0 0 if $sep eq '-hm'
430 0 0 if $sep eq 'hm'
438 0 0 unless $event->{'tags'}
451 0 0 if /^(-\d+)(m|y|month|year)$/
452 0 0 if /^(-\d+)$/
453 0 0 if /^(month|year)/
454 0 0 if /^--fill/
461 0 0 if ($res->{'interval'} =~ /^y/) { }
472 0 0 unless my($date, $hms, $project) = $file->basename =~ /^(\d+)-(\d+)_(.*)\.trc$/
474 0 0 if @project_re and not grep({$event->{'project'} =~ /$_/;} @project_re)
475 0 0 if $tags and not grep({$tags =~ /\b$_\b/;} @{$$event{'tags'};})
480 0 0 @{$res->{'log'};} ? :
0 0 if $res->{'fill'}
484 0 0 if @{$res->{'log'};} and not $res->{'log'}[-1]{'project'} and $res->{'log'}[-1]{'start'}->mday == $event->{'start'}->mday
490 0 0 if (my $method = $self->can(sprintf('_group_by_%s', $self->group_by || 'nothing')))
500 0 0 if $self->month and not $self->year
502 0 0 if $self->year
503 0 0 if $self->month
514 0 0 unless (-t STDIN and $self->year || $self->month)
516 0 0 unless $code =~ /^\s*sub\b/s
517 0 0 unless $code = eval "use 5.10.1;use strict;use warnings;$code"
523 0 0 unless $info{'file'} =~ /^$re$/
525 0 0 unless $code
528 0 0 if $code and $self->$code($event)
529 0 0 unless $info{'file'} eq $event->{'path'}
542 0 0 unless $event->{'tags'}
545 0 0 if (my $duration = $event->{'stop'} && $event->{'start'} && $event->{'stop'} - $event->{'start'})
548 0 0 if ($event->{'stop'} and $event->{'seconds'} < $self->config('min_time'))
558 0 0 if $event->{'start'}
559 0 0 if $event->{'stop'}
562 0 0 unless -d $event->{'path'}->dirname
569 0 0 if @_
570 0 0 unless $self->tag
577 0 0 if not $event->{'start'} or $event->{'stop'}
582 0 0 if ($duration->seconds < $self->config('min_time'))
586 0 0 unless unlink $event->{'path'}
590 0 0 if ($self->_save($event))
601 7 0 @_ == 1 ? :
603 7 0 if ($t{'str'})
605 2 5 if not $hms and $ymd =~ /:/
606 2 5 if $ymd =~ s/(\d{4})//
607 3 4 if $ymd =~ s/0?(\d{1,2})-(\d+)/$2/
608 5 2 if $ymd =~ s/0?(\d{1,2})//
609 7 0 if $hms =~ s/0?(\d{1,2})//
610 4 3 if $hms =~ s/0?(\d{1,2})//
611 3 4 if $hms =~ s/0?(\d{1,2})//
615 0 7 unless ref $ref
619 4 0 defined $t{'H'} || defined $t{'M'} ? :
620 3 0 defined $t{'H'} ? :
623 0 7 if $t{'m'} <= 0
624 0 7 if $t{'m'} > 12
629 1 6 unless (eval { do { $t{'iso'} = sprintf('%s-%02s-%02sT%02s:%02s:%02s', @t{'Y', 'm', 'd', 'H', 'M', 'S'}); $t{'tp'} = 'Time::Piece'->strptime("$t{'iso'}+0000", '%Y-%m-%dT%H:%M:%S%z') } })
632 1 0 if $t{'str'}
646 0 0 if ($start->day_of_week != 0 and $start->day_of_week != 6)
647 0 0 if $start < $NOW
653 0 0 $NOW->hour > 12 ? :