Branch Coverage

blib/lib/Monitoring/TT.pm
Criterion Covered Total %
branch 21 204 10.2


line true false branch
51 0 3 if $ENV{'TEST_AUTHOR'}
52 0 3 if -f '.author'
73 0 0 unless $self->_get_options
77 0 0 unless (-d $in . '/.')
85 0 0 if (-e $self->{'out'} and not $self->{'opt'}{'force'})
87 0 0 if (scalar @files > 0)
94 0 0 if $self->{'opt'}{'templatefilter'}
95 0 0 if $self->{'opt'}{'contactfilter'}
96 0 0 if $self->{'opt'}{'hostfilter'}
105 0 0 unless $self->{'opt'}{'templatefilter'}
107 0 0 if $Monitoring::TT::Log::Verbose >= 2
124 4 2 if $self->{'_tt'}
159 0 0 unless &GetOptions('h|help', \$self->{'opt'}{'help'}, 'v|verbose', sub { $self->{'opt'}{'verbose'}++; } , 'q|quiet', \$self->{'opt'}{'quiet'}, 'V|version', \$self->{'opt'}{'version'}, 'f|force', \$self->{'opt'}{'force'}, 'cf|contactfilter=s', \$self->{'opt'}{'contactfilter'}, 'hf|hostfilter=s', \$self->{'opt'}{'hostfilter'}, 'tf|templatefilter=s', \$self->{'opt'}{'templatefilter'}, 'n|dry-run', \$self->{'opt'}{'dryrun'}, '<>', sub { push @{$$self{'opt'}{'files'};}, $_[0]; } )
160 0 0 if ($self->{'opt'}{'version'})
161 0 0 if $self->{'opt'}{'help'}
162 0 0 if scalar @{$self->{'opt'}{'files'};} <= 1
166 0 0 if $self->{'opt'}{'quiet'}
167 0 0 if $self->{'opt'}{'contactfilter'}
168 0 0 if $self->{'opt'}{'hostfilter'}
169 0 0 if $self->{'opt'}{'templatefilter'}
171 0 0 if $self->{'opt'}{'dryrun'}
178 0 0 if $msg
187 0 0 if (-d $in . '/static/.')
205 0 0 if defined $self->{'opt'}{'templatefilter'} and not $file =~ /$self->{'opt'}{'templatefilter'}/mx
209 0 0 if $outfile =~ /^hosts.*\.cfg/gmx
210 0 0 if $outfile =~ /^contacts.*\.cfg/gmx
213 0 0 unless open my $fh, '>', $outfile
232 0 0 unless scalar keys %{$input_types;} > 0
246 0 0 if $Monitoring::TT::Log::Verbose >= 4
253 0 0 unless defined $o
254 0 0 if defined $typefilter and not join(',', values %{$o;}) =~ /$typefilter/mx
255 0 0 if $Monitoring::TT::Log::Verbose >= 5
266 0 0 unless open my $fh, '>', $outfile
274 0 0 if defined $self->{'opt'}{'templatefilter'} and not $file =~ /$self->{'opt'}{'templatefilter'}/mx
275 0 0 if $file =~ m[^$in/conf\.d/apps]mx
276 0 0 if $file =~ m[^$in/conf\.d/contacts]mx
277 0 0 if $file =~ m[^$in/conf\.d/hosts]mx
283 0 0 unless open my $fh, '>', $outfile
303 0 0 if $num == 0
315 0 0 if ($line =~ /:(\d+)$/mx)
332 0 0 if $Monitoring::TT::Log::Verbose >= 4
333 0 0 if (-e $path)
336 0 0 if defined $self->{'opt'}{'templatefilter'} and not $t =~ /$self->{'opt'}{'templatefilter'}/mx
339 0 0 $required_type ? :
0 0 scalar @{$tags;} > 0 ? :
340 0 0 if ($required_type)
352 0 0 if $required_type
361 0 0 if (defined $appdirs and scalar @{$appdirs;} > 0)
365 0 0 if $Monitoring::TT::Log::Verbose >= 4
366 0 0 if (-e $path)
369 0 0 if defined $self->{'opt'}{'templatefilter'} and not $t =~ /$self->{'opt'}{'templatefilter'}/mx
371 0 0 scalar @{$apps;} > 0 ? :
388 0 0 if ($found == 0)
393 0 0 if ($Monitoring::TT::Log::Verbose >= 4)
403 0 0 if (not -d $dir and $dir =~ /$pattern/mx)
407 0 0 unless -d $dir
408 0 0 unless opendir my $d, $dir
410 0 0 if substr($file, 0, 1) eq '.'
411 0 0 if (-d $dir . '/' . $file . '/.') { }
414 0 0 unless $file =~ /$pattern/mx
425 2 1 unless (defined $self->{'_config_template'})
429 0 0 if (-e $in . '/config.cfg')
437 0 3 if ($Monitoring::TT::Log::Verbose >= 4)
445 0 3 unless $self->tt->process(\$template, $data, \$output)
461 0 0 unless (-x $processor)
467 0 0 if ($rc != 0)
481 0 0 unless -d $dir . '/lib/.'
483 0 0 if $Monitoring::TT::Log::Verbose >= 4
486 0 1 if ($Monitoring::TT::Log::Verbose >= 4)
494 2 10 if defined $uniq_libs->{$inc}
498 0 4 if $Monitoring::TT::Log::Verbose >= 4
501 2 2 unless defined $uniq_types->{$types}{$file}
519 0 0 if $@
523 0 0 if $Monitoring::TT::Log::Verbose >= 4
525 0 0 unless defined $input_types->{$type}
535 0 0 if $self->{'opt'}{'dryrun'}
538 0 0 if $Monitoring::TT::Log::Verbose >= 4
539 0 0 if (-x $hook)
541 0 0 if defined $args
550 0 0 if ($rc)
564 0 3 unless open my $fh, '<', $template
567 3 22 if ($. == 1)
569 0 3 if (substr($line, 0, 3) eq $bom)
574 3 22 if ($line =~ /^define\s+(\w+)/mox)
575 3 0 if ($1 eq 'service' or $1 eq 'host' or $1 eq 'contact') { }
604 0 0 if ($tterror =~ /input\s+text\s+line\s+(\d+)/mx)
608 0 0 if ($realfile)
615 0 0 if ($tterror =~ /var\.undef\ error\ -\ undefined\ variable:\s+(.*)$/mx)
623 0 0 if ($line =~ /\Q$err\E/mx)
625 0 0 if ($realfile)
632 0 0 unless $already_printed
635 0 0 if $Monitoring::TT::Log::Verbose >= 4
643 0 0 if (defined $lines->[$x] and $lines->[$x] =~ /SRC\s+(.*):(\d+)/mx)
657 0 0 if $path eq ''
658 0 0 unless -d $path
668 0 0 if ($o->{'type'} and $o->{'type'} ne 'contact')
669 0 0 unless defined $$self{$type . 'possible_types'}{$o->{'type'}}
671 0 0 if ($o->{'tags'})
673 0 0 if substr($t, 0, 1) eq '_'
674 0 0 unless defined $$self{$type . 'possible_tags'}{$t}
677 0 0 if ($o->{'apps'})
679 0 0 unless defined $$self{$type . 'possible_apps'}{$a}