lib/Perl/Critic/Policy/RegularExpressions/RequireLineBoundaryMatching.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 80.0% 4 / 5 totaltotal 91.8% 45 / 49 CC 3 SCAR 4.5
CC
3
Cov
91%
violates
3.5
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« lib/Perl/Critic/Policy/RegularExpressions/RequireDotMatchAnything.pm ↑ Summary lib/Perl/Critic/Policy/ControlStructures/ProhibitCascadingIfElse.pm »
1 package Perl::Critic::Policy::RegularExpressions::RequireLineBoundaryMatching;
2  
3 40 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 40 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 40 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 40 ▶use Perl::Critic::Utils qw{ :severities };
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 40 ▶use parent 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 40 our $VERSION = '1.156';
13  
14 #-----------------------------------------------------------------------------
15  
16 40 Readonly::Scalar my $DESC => q{Regular expression without "/m" flag};
17 40 Readonly::Scalar my $EXPL => [ 237 ];
18  
19 #-----------------------------------------------------------------------------
20  
21 90 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
22 75 ▶sub default_severity { return $SEVERITY_LOW }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
23 83 ▶sub default_themes { return qw(core pbp cosmetic) }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
24 31 ▶sub applies_to { return qw(PPI::Token::Regexp::Match
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
25 PPI::Token::Regexp::Substitute
26 PPI::Token::QuoteLike::Regexp) }
27  
28 #-----------------------------------------------------------------------------
29  
30 1 ▶sub violates {
Subroutine violates: called CC=3 SCAR=12.5
Pod documented
31 1 my ( $self, $elem, $doc ) = @_;
32  
33 1 ▶ my $re = $doc->ppix_regexp_from_element( $elem )
Branch: 1 branch
BranchTrueFalseTotal
my $re = $doc->ppix_regexp_from_element($elem) or return 1 0 1
34 or return;
35 1 ▶ $re->modifier_asserted( 'm' )
Branch: 1 branch
BranchTrueFalseTotal
$re->modifier_asserted("m") or return $self->violation($DESC, $EXPL, $elem) 0 1 1
36 or return $self->violation( $DESC, $EXPL, $elem );
37  
38 0 return; #ok!;
39 }
40  
41 40 1;
42  
43 __END__
« lib/Perl/Critic/Policy/RegularExpressions/RequireDotMatchAnything.pm ↑ Summary lib/Perl/Critic/Policy/ControlStructures/ProhibitCascadingIfElse.pm »