blib/lib/Code/TidyAll/Plugin/Flake8.pm

filter: Statementstmt 61.5% 16 / 26 Branchbran 25.0% 1 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 62.5% 5 / 8 Podpod 100% 1 / 1 totaltotal 54.5% 24 / 44 CC 4 SCAR 11.6
CC
4
Cov
55%
validate_file
6.0
BEGIN
4.9
__ANON__
2.0
CRAP 3.2
↑ Summary
1 package Code::TidyAll::Plugin::Flake8;
2 1 $Code::TidyAll::Plugin::Flake8::VERSION = '0.4.0';
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use String::ShellQuote qw/ shell_quote /;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use vars qw/ $_check /;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 BEGIN
9 1 ▶{
Subroutine BEGIN: called CC=3 SCAR=16.0
10 1 my $code = <<'EOF';
11 from flake8.main import application
12  
13 def _py_check(fn):
14 app = application.Application()
15 app.run([fn])
16 return ((app.result_count > 0) or app.catastrophic_failure)
17 EOF
18 ## no critic
19 0 ▶ if ( ( eval "use Inline Python => \$code" ) and !$@ )
Subroutine BEGIN: called CC=1 SCAR=1.6
Branch: 1 branch
BranchTrueFalseTotal
if (eval 'use Inline Python => $code' and not $@) { } 0 1 1
Condition33%1/3
eval "use Inline Python => \$code" and not $@
!ll&&!rl&&r
100
MC/DC0%0/2
eval "use Inline Python => \$code" and not $@
eval "use Inline Python => \$code" not $@
Truth table33%1/3
A and not(B)
A= eval "use Inline Python => \$code"B= not $@
ABresult
0X0
100
111
20 {
21 ## use critic
22 0 ▶ $_check = sub { return _py_check(shift); };
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 }
24 else
25 {
26 0 ▶ $_check = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 0 my $cmd = shell_quote( 'flake8', shift );
28 0 return scalar `$cmd`;
29 1 };
30 }
31 }
32 1 extends 'Code::TidyAll::Plugin';
33  
34 sub validate_file
35 0 ▶{
Subroutine validate_file: not called CC=2 SCAR=17.9
Pod documented
36 0 my ( $self, $fn ) = @_;
37 0 ▶ if ( my $error = $_check->($fn) )
Branch: 1 branch
BranchTrueFalseTotal
if (my $error = &$Code::TidyAll::Plugin::Flake8::_check($fn)) 0 0 0
38 {
39 0 die qq#flake8 validation failed for the file "$fn" ; error="$error"#;
40 }
41 0 return;
42 }
43  
44 1 1;
45  
46 __END__
↑ Summary