Branch Coverage

blib/lib/YAML/Tidy.pm
Criterion Covered Total %
branch 202 234 86.3


line true false branch
25 0 6 $ENV{'YAML_TIDY_DEBUG'} ? :
46 3024 13 if (@lines)
48 2856 168 if $self->cfg->trimtrailing
59 975 21449 if ($node->{'flow'})
66 0 21449 unless @$lines
68 3347 18102 if ($level == -1 and $type eq "DOC")
78 18425 3024 $parent ? :
82 0 21449 unless (defined $line)
88 10329 11120 if ($node->is_collection) { }
90 6372 3957 if ($level < 0 or $ignore_firstlevel)
97 2274 1683 if ($level == 0)
100 2492 1465 if ($type eq 'MAP') { }
1465 0 elsif ($type eq 'SEQ') { }
101 317 2175 if ($before =~ tr/ /\000-\037!-\377/c)
102 12 305 if ($indent == 1)
108 247 1218 if ($before =~ tr/ /\000-\037!-\377/c) { }
109 12 235 if ($indent == 1)
114 370 848 if ($parent->{'type'} eq "MAP" and not $node->{'index'} % 2)
122 588 3369 if ($diff)
133 282 10838 if ($node->empty_scalar)
136 261 10577 if ($node->{'name'} eq "alias_event")
139 4395 3385 if ($parent->{'type'} eq "MAP" and ($node->{'index'} % 2 and not $node->multiline))
148 901 5281 if ($scalar->[2] =~ /[>|]/u)
155 5311 871 if ($before =~ tr/\t /\000-\b\n-\037!-\377/c)
158 5311 0 if $before =~ s/([\t ]+)$/ /u
160 4140 1171 unless ($node->multiline)
168 6180 2 unless ($ignore_firstlevel)
171 5591 740 if ($i == $startline and $col > 0)
173 5311 280 if ($before =~ tr/ /\000-\037!-\377/c)
177 0 1020 unless ($line =~ tr/ /\000-\037!-\377/c)
181 1020 0 if $line =~ s/^( *)/$new_spaces/u
182 869 151 if ($i == $startline)
184 409 460 unless ($node->multiline)
192 155 6027 if $explicit_indent
207 746 5281 if ($block) { }
5281 0 elsif ($node->{'style'} == 1 or $node->{'style'} == 2 or $node->{'style'} == 3) { }
211 68 5 if ($trimtrailing)
216 68 678 if ($nextline > $endline + 1)
221 373 373 if (not $ignore_firstlevel and length $sp != $new_indent) { }
348 25 elsif ($trimtrailing) { }
223 274 905 unless (length $line)
226 132 773 if (not $line =~ tr/ /\000-\037!-\377/c and length $line <= length $sp)
227 124 8 if ($trimtrailing)
232 42 731 if ($line =~ /^( *)\#/u) { }
236 31 11 if ($diff > 0) { }
11 0 elsif ($diff < 0) { }
240 0 11 if ($cindent < 0)
255 228 689 if (not $line =~ tr/ /\000-\037!-\377/c and length $line <= length $sp)
265 0 5281 if ($node->empty_scalar)
269 1141 4140 if (not $skipfirst or $node->multiline)
271 391 750 if $skipfirst
273 0 1141 if $startline >= @$lines
276 1 1140 if ($ignore_firstlevel)
281 0 1141 if ($level == 0 and not $indenttoplevelscalar)
285 1747 301 if ($line =~ tr/ /\000-\037!-\377/c)
286 1747 0 if $line =~ s/^([\t ]*)/$new_spaces/u
293 4549 732 if (not $node->multiline)
317 1276 7668 if (defined $default_style and $node->{'style'} != $default_style)
319 1102 174 if ($changed)
323 120 982 if (defined $node->{'anchor'} or $node->{'tag'})
329 1077 25 if ($diff)
340 156 1120 if (grep {$_ eq $value;} @all or $value =~ /($re)/u) { }
347 0 1120 if $emit =~ tr/\n//
349 548 29 $first eq '"' ? :
543 577 $first eq q['] ? :
353 1102 18 if ($new_style eq $style)
377 339 3008 if ($node->open->{'implicit'} and $self->cfg->addheader and not $self->partial) { }
159 3645 elsif ($node->{'index'} == 1 and not $open->{'implicit'} and $self->cfg->removeheader and not $self->partial) { }
390 21 138 if ($open->{'version_directive'} or $open->{'tag_directives'} or not $child->is_collection and $child->empty_scalar) { }
395 99 39 if ($line =~ /^---[ \t]*$/u) { }
0 39 elsif ($line =~ s/^---[ \t]+(?=#)//u) { }
408 531 2816 if ($close->{'implicit'} and $self->cfg->addfooter and not $self->partial) { }
27 2909 elsif (not $close->{'implicit'} and $self->cfg->removefooter and not $self->partial) { }
419 15 12 if ($next and $next->open->{'version_directive'} || $next->open->{'tag_directives'}) { }
424 12 0 if ($line =~ /^\.\.\.[ \t]*$/u) { }
0 0 elsif ($line =~ s/^\.\.\.[ \t]+(?=#)//u) { }
439 11171 13244 if ($node->is_collection) { }
12988 256 elsif (defined $node->{'style'}) { }
444 6017 5154 if ($level == -1)
450 847 12141 if ($node->{'style'} eq 4 or $node->{'style'} eq 5)
460 0 3996 unless $parent
464 226 3770 if $level == 0
466 2591 1405 unless ($node->is_collection)
470 97 1308 if ($parent->{'type'} eq "MAP" and $node->{'index'} % 2)
479 902 406 if ($before =~ tr/\t /\000-\b\n-\037!-\377/c)
484 295 1013 unless ($before_end =~ tr/\t /\000-\b\n-\037!-\377/c)
500 128 2463 if ($node->empty_scalar)
508 2091 372 if ($before =~ tr/\t /\000-\b\n-\037!-\377/c)
538 7149 166 $i == 0 ? :
539 4752 2563 $i == $#slice ? :
541 0 7315 if ($part =~ /^ *(\#.*)$/gu)
555 509 919 if ($type eq '&') { }
919 0 elsif ($type eq '!') { }
563 0 7315 if ($part =~ /\G *(\#.*)$/gu)
571 6973 342 if ($part =~ /\G *(\S)/gu)
597 19 1430 unless length $line
598 953 477 if ($fix < 0) { }
601 0 953 if ($offset > length $line)
604 953 0 if ($line =~ tr/ /\000-\037!-\377/c) { }
605 18 935 if ($line =~ /^ *\#/u)
619 0 477 unless ($line =~ tr/ /\000-\037!-\377/c)
657 3347 28160 if ($name =~ /document_start/u) { }
2203 25957 elsif ($name =~ /sequence_start/u) { }
3224 22733 elsif ($name =~ /mapping_start/u) { }
668 8774 22733 if ($name =~ /_start_event/u) { }
8774 13959 elsif ($name =~ /_end_event/u) { }
670 2203 6571 if ($name eq "sequence_start_event")
673 1469 734 if ($col > 0)
676 121 1348 if ($chr eq "-")
681 975 7305 if ($flow or ($event->{'style'} // -1) == 2 or ($event->{'style'} // -1) == 2)
708 1469 7305 if $flow
718 28509 2998 if ($i < $#$events)
750 0 0 if ($name =~ /scalar|alias/u) { }
0 0 elsif ($name =~ /end/u) { }
768 244 5824 if ($error)
772 0 698 if ($line =~ s/( +\n)//u)
780 0 6068 if ($type eq "html")