Branch Coverage

blib/lib/Monitoring/TT.pm
Criterion Covered Total %
branch 21 200 10.5


line true false branch
51 0 3 if $ENV{'TEST_AUTHOR'}
52 0 3 if -f '.author'
72 0 0 unless $self->_get_options
76 0 0 unless (-d $in . '/.')
84 0 0 if (-e $self->{'out'} and not $self->{'opt'}{'force'})
86 0 0 if (scalar @files > 0)
93 0 0 if $self->{'opt'}{'templatefilter'}
94 0 0 if $self->{'opt'}{'contactfilter'}
95 0 0 if $self->{'opt'}{'hostfilter'}
104 0 0 unless $self->{'opt'}{'templatefilter'}
105 0 0 if $Monitoring::TT::Log::Verbose >= 2
122 4 2 if $self->{'_tt'}
157 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]; } )
158 0 0 if ($self->{'opt'}{'version'})
159 0 0 if $self->{'opt'}{'help'}
160 0 0 if scalar @{$self->{'opt'}{'files'};} <= 1
164 0 0 if $self->{'opt'}{'quiet'}
165 0 0 if $self->{'opt'}{'contactfilter'}
166 0 0 if $self->{'opt'}{'hostfilter'}
167 0 0 if $self->{'opt'}{'templatefilter'}
169 0 0 if $self->{'opt'}{'dryrun'}
176 0 0 if $msg
185 0 0 if (-d $in . '/static/.')
203 0 0 if defined $self->{'opt'}{'templatefilter'} and not $file =~ /$self->{'opt'}{'templatefilter'}/mx
207 0 0 if $outfile =~ /^hosts.*\.cfg/gmx
208 0 0 if $outfile =~ /^contacts.*\.cfg/gmx
211 0 0 unless open my $fh, '>', $outfile
230 0 0 unless scalar keys %{$input_types;} > 0
244 0 0 if $Monitoring::TT::Log::Verbose >= 4
251 0 0 unless defined $o
252 0 0 if defined $typefilter and not join(',', values %{$o;}) =~ /$typefilter/mx
253 0 0 if $Monitoring::TT::Log::Verbose >= 5
264 0 0 unless open my $fh, '>', $outfile
272 0 0 if defined $self->{'opt'}{'templatefilter'} and not $file =~ /$self->{'opt'}{'templatefilter'}/mx
273 0 0 if $file =~ m[^$in/conf\.d/apps]mx
274 0 0 if $file =~ m[^$in/conf\.d/contacts]mx
275 0 0 if $file =~ m[^$in/conf\.d/hosts]mx
281 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)
460 0 0 unless -d $dir . '/lib/.'
462 0 0 if $Monitoring::TT::Log::Verbose >= 4
465 0 1 if ($Monitoring::TT::Log::Verbose >= 4)
473 2 10 if defined $uniq_libs->{$inc}
477 0 4 if $Monitoring::TT::Log::Verbose >= 4
480 2 2 unless defined $uniq_types->{$types}{$file}
498 0 0 if $@
502 0 0 if $Monitoring::TT::Log::Verbose >= 4
504 0 0 unless defined $input_types->{$type}
514 0 0 if $self->{'opt'}{'dryrun'}
517 0 0 if $Monitoring::TT::Log::Verbose >= 4
518 0 0 if (-x $hook)
520 0 0 if defined $args
529 0 0 if ($rc)
543 0 3 unless open my $fh, '<', $template
546 3 22 if ($. == 1)
548 0 3 if (substr($line, 0, 3) eq $bom)
553 3 22 if ($line =~ /^define\s+(\w+)/mox)
554 3 0 if ($1 eq 'service' or $1 eq 'host' or $1 eq 'contact') { }
583 0 0 if ($tterror =~ /input\s+text\s+line\s+(\d+)/mx)
587 0 0 if ($realfile)
594 0 0 if ($tterror =~ /var\.undef\ error\ -\ undefined\ variable:\s+(.*)$/mx)
602 0 0 if ($line =~ /\Q$err\E/mx)
604 0 0 if ($realfile)
611 0 0 unless $already_printed
614 0 0 if $Monitoring::TT::Log::Verbose >= 4
622 0 0 if (defined $lines->[$x] and $lines->[$x] =~ /SRC\s+(.*):(\d+)/mx)
636 0 0 if $path eq ''
637 0 0 unless -d $path
647 0 0 if ($o->{'type'})
648 0 0 unless defined $$self{$type . 'possible_types'}{$o->{'type'}}
650 0 0 if ($o->{'tags'})
652 0 0 if substr($t, 0, 1) eq '_'
653 0 0 unless defined $$self{$type . 'possible_tags'}{$t}
656 0 0 if ($o->{'apps'})
658 0 0 unless defined $$self{$type . 'possible_apps'}{$a}