Turndown/Tasklistitems.pm

filter: Statementstmt 100% 17 / 17 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 90.6% 29 / 32 CC 4 SCAR 4.8
CC
4
Cov
95%
__ANON__
2.1
__ANON__
2.0
install
2.0
CRAP 1.6
« Turndown/GFM.pm ↑ Summary Turndown/Strikethrough.pm »
1 package Text::HTML::Turndown::Tasklistitems 0.12;
2 1 ▶use 5.020;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use stable 'postderef';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use List::MoreUtils 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 our %RULES = (
8 taskListItems => {
9 215 ▶ filter => sub ($rule, $node, $options) {
Subroutine __ANON__: called CC=2 SCAR=7.2
10 215 ▶ return lc $node->getAttribute('type') eq 'checkbox'
Condition66%2/3
lc $node->getAttribute('type') eq 'checkbox' && uc $node->parentNode->nodeName eq 'LI'
!ll&&!rl&&r
21104
MC/DC50%1/2
lc $node->getAttribute('type') eq 'checkbox' && uc $node->parentNode->nodeName eq 'LI'
lc $node->getAttribute('type') eq 'checkbox' uc $node->parentNode->nodeName eq 'LI'
Truth table66%2/3
A && B
A= lc $node->getAttribute('type') eq 'checkbox'B= uc $node->parentNode->nodeName eq 'LI'
ABresult
0X0
100
111
11 && uc $node->parentNode->nodeName eq 'LI'
12 },
13 4 ▶ replacement => sub( $content, $node, $options, $context ) {
Subroutine __ANON__: called CC=2 SCAR=6.9
14 4 ▶ return (defined $node->getAttribute('checked') ? '[x]' : '[ ]') . ' '
Branch: 1 branch
BranchTrueFalseTotal
defined $node->getAttribute('checked') ? : 3 1 4
15 }
16 },
17 1 );
18  
19 22 ▶sub install ($class, $target) {
Subroutine install: called CC=2 SCAR=6.9
Pod undocumented
20 22 for my $key (keys %RULES) {
21 22 $target->addRule($key, $RULES{$key})
22 }
23 }
24  
25 1 1;
« Turndown/GFM.pm ↑ Summary Turndown/Strikethrough.pm »