Report/Generator.pm

filter: Statementstmt 57.5% 19 / 33 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 1 totaltotal 51.0% 24 / 47 CC 5 SCAR 26.6
CC
5
Cov
49%
as_string
30.0
_build_verbose
2.0
BEGIN
1.0
CRAP 14.3
« Report/Indicator.pm ↑ Summary Report/Distribution.pm »
1 package CPANTS::Kwalitee::Report::Generator;
2  
3 3 $CPANTS::Kwalitee::Report::Generator::VERSION = '0.10';
4 3 $CPANTS::Kwalitee::Report::Generator::AUTHORITY = 'cpan:MANWAR';
5  
6 =head1 NAME
7  
8 CPANTS::Kwalitee::Report::Generator - Interface to Kwalitee Generator.
9  
10 =head1 VERSION
11  
12 Version 0.10
13  
14 =cut
15  
16 3 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 3 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 3 ▶use overload q{""} => 'as_string', fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 3 has [qw(name version indicators)] => (is => 'ro', required => 1);
25 3 has 'verbose' => (is => 'lazy');
26  
27 0 ▶sub _build_verbose { 0 }
Subroutine _build_verbose: not called CC=1 SCAR=6.9
28  
29 =head1 DESCRIPTION
30  
31 It represents Kwalitee Generator.
32  
33 =head1 SYNOPSIS
34  
35 use strict; use warnings;
36 use CPANTS::Kwalitee::Report;
37  
38 my $report = CPANTS::Kwalitee::Report->new;
39  
40 print sprintf("%s\n\n", join("\n", @{$report->generators}));
41  
42 =head1 METHODS
43  
44 =head2 name()
45  
46 Returns generator name.
47  
48 =head2 version()
49  
50 Returns generator version as defined in the distribution L<Module::CPANTS::Analyse>.
51  
52 =head2 indicators()
53  
54 Returns an array ref of objects of type L<CPANTS::Kwalitee::Report::Indicator>.
55  
56 =cut
57  
58 sub as_string {
59 0 ▶ my ($self) = @_;
Subroutine as_string: not called CC=5 SCAR=34.0
Pod undocumented
60  
61 0 my $generator = sprintf("%s %s\n", $self->name, $self->version);
62 0 foreach my $indicator (@{$self->indicators}) {
63 0 $generator .= sprintf(" %s\n", $indicator->description);
64 0 ▶ if ($self->verbose) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->verbose) 0 0 0
65 0 my $error = $indicator->error;
66 0 my $remedy = $indicator->remedy;
67 0 ▶ if (defined $error) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $error) 0 0 0
68 0 $generator .= sprintf(" error: %s\n", $error);
69 }
70 0 ▶ if (defined $remedy) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $remedy) 0 0 0
71 0 $generator .= sprintf(" remedy: %s\n", $remedy);
72 }
73 }
74 }
75  
76 0 return $generator;
77 }
78  
79 =head1 AUTHOR
80  
81 Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
82  
83 =head1 REPOSITORY
84  
85 L<https://github.com/manwar/CPANTS-Kwalitee-Report>
86  
87 =head1 BUGS
88  
89 Please report any bugs or feature requests to C<bug-cpants-kwalitee-report at rt.cpan.org>,
90 or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CPANTS-Kwalitee-Report>.
91 I will be notified and then you'll automatically be notified of progress on your
92 bug as I make changes.
93  
94 =head1 SUPPORT
95  
96 You can find documentation for this module with the perldoc command.
97  
98 perldoc CPANTS::Kwalitee::Report::Generator
99  
100 You can also look for information at:
101  
102 =over 4
103  
104 =item * RT: CPAN's request tracker (report bugs here)
105  
106 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=CPANTS-Kwalitee-Report>
107  
108 =item * AnnoCPAN: Annotated CPAN documentation
109  
110 L<http://annocpan.org/dist/CPANTS-Kwalitee-Report>
111  
112 =item * CPAN Ratings
113  
114 L<http://cpanratings.perl.org/d/CPANTS-Kwalitee-Report>
115  
116 =item * Search CPAN
117  
118 L<http://search.cpan.org/dist/CPANTS-Kwalitee-Report/>
119  
120 =back
121  
122 =head1 LICENSE AND COPYRIGHT
123  
124 Copyright (C) 2017 Mohammad S Anwar.
125  
126 This program is free software; you can redistribute it and / or modify it under
127 the terms of the the Artistic License (2.0). You may obtain a copy of the full
128 license at:
129  
130 L<http://www.perlfoundation.org/artistic_license_2_0>
131  
132 Any use, modification, and distribution of the Standard or Modified Versions is
133 governed by this Artistic License.By using, modifying or distributing the Package,
134 you accept this license. Do not use, modify, or distribute the Package, if you do
135 not accept this license.
136  
137 If your Modified Version has been derived from a Modified Version made by someone
138 other than you,you are nevertheless required to ensure that your Modified Version
139 complies with the requirements of this license.
140  
141 This license does not grant you the right to use any trademark, service mark,
142 tradename, or logo of the Copyright Holder.
143  
144 This license includes the non-exclusive, worldwide, free-of-charge patent license
145 to make, have made, use, offer to sell, sell, import and otherwise transfer the
146 Package with respect to any patent claims licensable by the Copyright Holder that
147 are necessarily infringed by the Package. If you institute patent litigation
148 (including a cross-claim or counterclaim) against any party alleging that the
149 Package constitutes direct or contributory patent infringement,then this Artistic
150 License to you shall terminate on the date that such litigation is filed.
151  
152 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
153 CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
154 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
155 NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
156 REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
157 INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
158 OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
159  
160 =cut
161  
162 3 1; # End of CPANTS::Kwalitee::Report::Generator
« Report/Indicator.pm ↑ Summary Report/Distribution.pm »