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

filter: Statementstmt 100% 27 / 27 Branchbran 100% 4 / 4 Conditioncond 100% 6 / 6 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 97.8% 46 / 47 CC 5 SCAR 11.0
CC
5
Cov
100%
validate_file
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/Code/TidyAll/Plugin/JSON.pm ↑ Summary blib/lib/Code/TidyAll/Plugin/PerlCritic.pm »
1 package Code::TidyAll::Plugin::PodChecker;
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  
6 1 ▶use Pod::Checker;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Specio::Library::Numeric;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 extends 'Code::TidyAll::Plugin';
12  
13 1 our $VERSION = '0.83';
14  
15 1 has warnings => (
16 is => 'ro',
17 isa => t('PositiveInt'),
18 );
19  
20 sub validate_file {
21 6 ▶ my ( $self, $file ) = @_;
Subroutine validate_file: called CC=5 SCAR=16.1
Pod documented
22  
23 6 my $result;
24 6 ▶ my %options = ( $self->warnings ? ( '-warnings' => $self->warnings ) : () );
Branch: 1 branch
BranchTrueFalseTotal
$self->warnings ? : 3 3 6
25 6 my $checker = Pod::Checker->new(%options);
26 6 my $output;
27 6 open my $fh, '>', \$output;
28 6 $checker->parse_from_file( $file->stringify, $fh );
29 6 ▶ die $output
Branch: 1 branch
BranchTrueFalseTotal
if $checker->num_errors > 0 or $self->warnings and $checker->num_warnings > 0 3 3 6
Condition100%6/6
$checker->num_errors > 0 or $self->warnings and $checker->num_warnings > 0
l!l&&r!l&&!r
141
$self->warnings and $checker->num_warnings > 0
!ll&&!rl&&r
212
MC/DC66%2/3
$checker->num_errors > 0 or $self->warnings and $checker->num_warnings > 0
$checker->num_errors > 0 $self->warnings $checker->num_warnings > 0
Truth table75%3/4
A or B and C
A= $checker->num_errors > 0B= $self->warningsC= $checker->num_warnings > 0
ABCresult
1XX1
0111
00X0
0100
30 if $checker->num_errors > 0
31 || ( $self->warnings && $checker->num_warnings > 0 );
32 }
33  
34 1 1;
35  
36 # ABSTRACT: Use podchecker with tidyall
37  
38 __END__
39  
40 =pod
41  
42 =encoding UTF-8
43  
44 =head1 NAME
45  
46 Code::TidyAll::Plugin::PodChecker - Use podchecker with tidyall
47  
48 =head1 VERSION
49  
50 version 0.83
51  
52 =head1 SYNOPSIS
53  
54 In configuration:
55  
56 ; Check for errors, but ignore warnings
57 ;
58 [PodChecker]
59 select = lib/**/*.{pm,pod}
60  
61 ; Die on level 1 warnings (can also be set to 2)
62 ;
63 [PodChecker]
64 select = lib/**/*.{pm,pod}
65 warnings = 1
66  
67 =head1 DESCRIPTION
68  
69 Runs L<podchecker>, a POD validator, and dies if any problems were found.
70  
71 =head1 INSTALLATION
72  
73 Install podchecker from CPAN.
74  
75 cpanm podchecker
76  
77 =head1 CONFIGURATION
78  
79 This plugin accepts the following configuration options:
80  
81 =head2 warnings
82  
83 The level of warnings to consider as errors - 1 or 2. By default, warnings will
84 be ignored.
85  
86 =head1 SUPPORT
87  
88 Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>.
89  
90 =head1 SOURCE
91  
92 The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>.
93  
94 =head1 AUTHORS
95  
96 =over 4
97  
98 =item *
99  
100 Jonathan Swartz <swartz@pobox.com>
101  
102 =item *
103  
104 Dave Rolsky <autarch@urth.org>
105  
106 =back
107  
108 =head1 COPYRIGHT AND LICENSE
109  
110 This software is copyright (c) 2011 - 2022 by Jonathan Swartz.
111  
112 This is free software; you can redistribute it and/or modify it under
113 the same terms as the Perl 5 programming language system itself.
114  
115 The full text of the license can be found in the
116 F<LICENSE> file included with this distribution.
117  
118 =cut
« blib/lib/Code/TidyAll/Plugin/JSON.pm ↑ Summary blib/lib/Code/TidyAll/Plugin/PerlCritic.pm »