File Coverage

blib/lib/CPANTS/Kwalitee/Report/Generator.pm
Criterion Covered Total %
statement 14 28 50.0
branch 0 6 0.0
condition n/a
subroutine 5 7 71.4
pod 0 1 0.0
total 19 42 45.2


line stmt bran cond sub pod time code
1             package CPANTS::Kwalitee::Report::Generator;
2              
3             $CPANTS::Kwalitee::Report::Generator::VERSION = '0.10';
4             $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     3   69 use 5.006;
  3         12  
17 3     3   39 use Data::Dumper;
  3         8  
  3         155  
18              
19 3     3   17 use Moo;
  3         5  
  3         17  
20 3     3   6592 use namespace::clean;
  3         8  
  3         23  
21              
22 3     3   716 use overload q{""} => 'as_string', fallback => 1;
  3         8  
  3         20  
23              
24             has [qw(name version indicators)] => (is => 'ro', required => 1);
25             has 'verbose' => (is => 'lazy');
26              
27 0     0     sub _build_verbose { 0 }
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     0 0   my ($self) = @_;
60              
61 0           my $generator = sprintf("%s %s\n", $self->name, $self->version);
62 0           foreach my $indicator (@{$self->indicators}) {
  0            
63 0           $generator .= sprintf(" %s\n", $indicator->description);
64 0 0         if ($self->verbose) {
65 0           my $error = $indicator->error;
66 0           my $remedy = $indicator->remedy;
67 0 0         if (defined $error) {
68 0           $generator .= sprintf(" error: %s\n", $error);
69             }
70 0 0         if (defined $remedy) {
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             1; # End of CPANTS::Kwalitee::Report::Generator