lib/Serge/Engine/Plugin/process_if.pm

filter: Statementstmt 38.8% 7 / 18 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod 0.0% 0 / 4 totaltotal 28.1% 9 / 32 SCAR 17.7
CC
3
Cov
32%
validate_data
12.0
name
2.0
init
2.0
CRAP 5.9
« lib/Serge/Command/gendocs.pm ↑ Summary bin/tools/lib/cli.pm »
1 package Serge::Engine::Plugin::process_if;
2 1 ▶use parent Serge::Engine::Plugin::if;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 sub name {
7 0 ▶ return 'Allow or disallow processing based on file/lang/content/comment matching conditions';
Subroutine name: not called CC=1 SCAR=6.9
Pod undocumented
8 }
9  
10 sub init {
11 0 ▶ my $self = shift;
Subroutine init: not called CC=1 SCAR=6.9
Pod undocumented
12  
13 0 $self->SUPER::init(@_);
14  
15 0 $self->add({
16 can_process_source_file => \&check,
17 can_extract => \&check,
18 can_process_ts_file => \&check,
19 can_generate_ts_file => \&check,
20 can_translate => \&check,
21 can_generate_localized_file => \&check,
22 can_generate_localized_file_source => \&check,
23 can_save_localized_file => \&check,
24 });
25 }
26  
27 sub validate_data {
28 0 ▶ my $self = shift;
Subroutine validate_data: not called CC=3 SCAR=24.8
Pod undocumented
29  
30 0 $self->SUPER::validate_data;
31  
32 # this plugin makes sense only when there are rules defined
33 0 ▶ die "'if' block is missing" unless exists $self->{data}->{if};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"data"}{"if"} 0 0 0
34 0 ▶ die "'if' block should contain at least one rule defined in it" unless scalar(@{$self->{data}->{if}}) > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$self->{"data"}{"if"};} > 0 0 0 0
35 }
36  
37 sub check {
38 0 ▶ my $self = shift;
Subroutine check: not called CC=1 SCAR=6.9
Pod undocumented
39 0 return $self->SUPER::check(@_);
40 }
41  
42 1 1;
« lib/Serge/Command/gendocs.pm ↑ Summary bin/tools/lib/cli.pm »