lib/Aitextcleaner/FormattingResidue.pm

filter: Statementstmt 100% 34 / 34 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 86.9% 40 / 46 CC 3 SCAR 7.0
CC
3
Cov
92%
clean_formatting_residue
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
↑ Summary
1 package Aitextcleaner::FormattingResidue;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '0.2.0';
8 1 our @EXPORT_OK = qw(clean_formatting_residue);
9  
10 1 ▶sub clean_formatting_residue {
Subroutine clean_formatting_residue: called CC=3 SCAR=11.0
Pod undocumented
11 1 my ($text) = @_;
12 1 ▶ die 'text must be a string' if !defined($text) || ref($text);
Branch: 1 branch
BranchTrueFalseTotal
if not defined $text or ref $text 0 1 1
Condition33%1/3
not defined $text or ref $text
l!l&&r!l&&!r
001
MC/DC0%0/2
not defined $text or ref $text
not defined $text ref $text
Truth table33%1/3
not(A) or B
A= not defined $textB= ref $text
ABresult
1X1
011
000
13 1 $text =~ s{</?(?:address|article|blockquote|br|div|li|p|pre|section)\b[^>]*>}{\n}gi;
14 1 $text =~ s{<[^>]*>}{}g;
15 1 $text =~ s/&amp;/\&/g;
16 1 $text =~ s/&lt;/</g;
17 1 $text =~ s/&gt;/>/g;
18 1 $text =~ s/&quot;/"/g;
19 1 $text =~ s/&#39;|&apos;/'/g;
20 1 $text =~ s/&nbsp;/ /g;
21 1 $text =~ s/“/"/g;
22 1 $text =~ s/”/"/g;
23 1 $text =~ s/‘/'/g;
24 1 $text =~ s/’/'/g;
25 1 $text =~ s/–/-/g;
26 1 $text =~ s/—/-/g;
27 1 $text =~ s/…/.../g;
28 1 $text =~ s/[ \t]+\n/\n/g;
29 1 $text =~ s/\n{3,}/\n\n/g;
30 1 $text =~ s/^\s+//;
31 1 $text =~ s/\s+$//;
32 1 return $text;
33 }
34  
35 1 1;
↑ Summary