blib/lib/Dist/Zilla/Plugin/Test/Kwalitee.pm

filter: Statementstmt 100% 45 / 45 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 13 / 13 Podpod 0.0% 0 / 3 totaltotal 93.8% 61 / 65 CC 3 SCAR 2.4
CC
3
Cov
98%
__ANON__
2.0
gather_files
2.0
BEGIN
1.0
CRAP 1.3
↑ Summary
1 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Dist::Zilla::Plugin::Test::Kwalitee; # git description: v2.12-14-gd99ceea
4 # ABSTRACT: Author tests for kwalitee
5 # KEYWORDS: plugin testing tests distribution kwalitee CPANTS quality lint errors critic
6 # vim: set ts=8 sts=2 sw=2 tw=115 et :
7  
8 2 our $VERSION = '2.13';
9  
10 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Sub::Exporter::ForMethods 'method_installer'; # method_installer returns a sub.
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Data::Section 0.004 # fixed header_re
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 { installer => method_installer }, '-setup';
14 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 with
17 'Dist::Zilla::Role::FileGatherer',
18 'Dist::Zilla::Role::TextTemplate',
19 'Dist::Zilla::Role::PrereqSource';
20  
21 2 ▶sub mvp_multivalue_args { return qw( skiptest ) }
Subroutine mvp_multivalue_args: called CC=1 SCAR=0.0
Pod undocumented
22  
23 has skiptest => (
24 isa => 'ArrayRef[Str]',
25 traits => [ 'Array' ],
26 1 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
27 2 handles => {
28 skiptest => 'sort',
29 push_skiptest => 'push'
30 },
31 );
32  
33 has filename => (
34 is => 'ro', isa => 'Str',
35 lazy => 1,
36 1 ▶ default => sub { return 'xt/release/kwalitee.t' },
Subroutine __ANON__: called CC=1 SCAR=0.0
37 2 );
38  
39 around dump_config => sub
40 2 ▶{
Subroutine __ANON__: called CC=2 SCAR=7.0
41 2 my ($orig, $self) = @_;
42 2 my $config = $self->$orig;
43  
44 2 ▶ $config->{+__PACKAGE__} = {
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($self) ne __PACKAGE__ ? : 0 2 2
45 skiptest => [ $self->skiptest ],
46 filename => $self->filename,
47 blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (),
48 };
49 2 return $config;
50 2 };
51  
52 4 ▶sub _tk_prereq { '1.21' }
Subroutine _tk_prereq: called CC=1 SCAR=0.0
53  
54 sub register_prereqs
55 2 ▶{
Subroutine register_prereqs: called CC=1 SCAR=0.0
Pod undocumented
56 2 my $self = shift;
57 2 $self->zilla->register_prereqs(
58 {
59 phase => 'develop',
60 type => 'requires',
61 },
62 'Test::Kwalitee' => $self->_tk_prereq,
63 );
64 }
65  
66 2 ▶sub gather_files {
Subroutine gather_files: called CC=2 SCAR=6.9
Pod undocumented
67 2 my ( $self, ) = @_;
68  
69 2 my $test_options = '';
70  
71 2 my @skiptests = $self->skiptest;
72 2 ▶ if (@skiptests > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@skiptests > 0) 1 1 2
73 1 my $skip = join ' ', map "-$_", @skiptests;
74 1 $test_options = qq{ qw( $skip ) };
75 }
76  
77 2 require Dist::Zilla::File::InMemory;
78  
79 2 my $filename = $self->filename;
80  
81 my $content = $self->fill_in_string(
82 2 ${$self->section_data('__TEST__')},
83 {
84 dist => \($self->zilla),
85 plugin => \$self,
86 test_options => \$test_options,
87 tk_prereq => \($self->_tk_prereq),
88 },
89 );
90  
91 2 $self->add_file(
92 Dist::Zilla::File::InMemory->new( {
93 'name' => $filename,
94 'content' => $content,
95 } ),
96 );
97 };
98  
99 2 __PACKAGE__->meta->make_immutable;
100  
101 #pod =pod
102 #pod
103 #pod =head1 SYNOPSIS
104 #pod
105 #pod In your F<dist.ini>:
106 #pod
107 #pod [Test::Kwalitee]
108 #pod skiptest = use_strict ; Don't test for strictness.
109 #pod
110 #pod =head1 DESCRIPTION
111 #pod
112 #pod This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the
113 #pod following file:
114 #pod
115 #pod xt/release/kwalitee.t - a standard Test::Kwalitee test
116 #pod
117 #pod =head1 CONFIGURATION OPTIONS
118 #pod
119 #pod =for stopwords skiptest
120 #pod
121 #pod =head2 skiptest
122 #pod
123 #pod The name of a kwalitee metric to skip (see the list in L<Test::Kwalitee>.
124 #pod Can be used more than once.
125 #pod
126 #pod =head2 filename
127 #pod
128 #pod The filename of the test to add - defaults to F<xt/release/kwalitee.t>.
129 #pod
130 #pod =for Pod::Coverage mvp_multivalue_args register_prereqs gather_files
131 #pod
132 #pod =head1 SEE ALSO
133 #pod
134 #pod =for :list
135 #pod * L<Module::CPANTS::Analyse>
136 #pod * L<App::CPANTS::Lint>
137 #pod * L<Test::Kwalitee>
138 #pod * L<Dist::Zilla::App::Command::kwalitee>
139 #pod * L<Test::Kwalitee::Extra>
140 #pod * L<Dist::Zilla::Plugin::Test::Kwalitee::Extra>
141 #pod
142 #pod =cut
143  
144 =pod
145  
146 =encoding UTF-8
147  
148 =head1 NAME
149  
150 Dist::Zilla::Plugin::Test::Kwalitee - Author tests for kwalitee
151  
152 =head1 VERSION
153  
154 version 2.13
155  
156 =head1 SYNOPSIS
157  
158 In your F<dist.ini>:
159  
160 [Test::Kwalitee]
161 skiptest = use_strict ; Don't test for strictness.
162  
163 =head1 DESCRIPTION
164  
165 This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the
166 following file:
167  
168 xt/release/kwalitee.t - a standard Test::Kwalitee test
169  
170 =head1 CONFIGURATION OPTIONS
171  
172 =for stopwords skiptest
173  
174 =head2 skiptest
175  
176 The name of a kwalitee metric to skip (see the list in L<Test::Kwalitee>.
177 Can be used more than once.
178  
179 =head2 filename
180  
181 The filename of the test to add - defaults to F<xt/release/kwalitee.t>.
182  
183 =for Pod::Coverage mvp_multivalue_args register_prereqs gather_files
184  
185 =head1 SEE ALSO
186  
187 =over 4
188  
189 =item *
190  
191 L<Module::CPANTS::Analyse>
192  
193 =item *
194  
195 L<App::CPANTS::Lint>
196  
197 =item *
198  
199 L<Test::Kwalitee>
200  
201 =item *
202  
203 L<Dist::Zilla::App::Command::kwalitee>
204  
205 =item *
206  
207 L<Test::Kwalitee::Extra>
208  
209 =item *
210  
211 L<Dist::Zilla::Plugin::Test::Kwalitee::Extra>
212  
213 =back
214  
215 =head1 GIVING THANKS
216  
217 =for stopwords MetaCPAN GitHub
218  
219 If you found this module to be useful, please show your appreciation by
220 adding a +1 in L<MetaCPAN|https://metacpan.org/dist/Dist-Zilla-Plugin-Test-Kwalitee>
221 and a star in L<GitHub|https://github.com/karenetheridge/Dist-Zilla-Plugin-Test-Kwalitee>.
222  
223 =head1 SUPPORT
224  
225 Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-Kwalitee>
226 (or L<bug-Dist-Zilla-Plugin-Test-Kwalitee@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-Test-Kwalitee@rt.cpan.org>).
227  
228 There is also a mailing list available for users of this distribution, at
229 L<http://dzil.org/#mailing-list>.
230  
231 There is also an irc channel available for users of this distribution, at
232 L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>.
233  
234 =head1 AUTHORS
235  
236 =over 4
237  
238 =item *
239  
240 Marcel Gruenauer <marcel@cpan.org>
241  
242 =item *
243  
244 Harley Pig <harleypig@gmail.com>
245  
246 =item *
247  
248 Caleb Cushing <xenoterracide@gmail.com>
249  
250 =item *
251  
252 Kent Fredric <kentfredric@gmail.com>
253  
254 =item *
255  
256 Karen Etheridge <ether@cpan.org>
257  
258 =back
259  
260 =head1 CONTRIBUTORS
261  
262 =for stopwords Marcel Gruenauer Mike Doherty Graham Knop
263  
264 =over 4
265  
266 =item *
267  
268 Marcel Gruenauer <hanekomu@gmail.com>
269  
270 =item *
271  
272 Mike Doherty <doherty@cs.dal.ca>
273  
274 =item *
275  
276 Graham Knop <haarg@haarg.org>
277  
278 =back
279  
280 =head1 COPYRIGHT AND LICENSE
281  
282 This software is copyright (c) 2010 by Marcel Gruenauer.
283  
284 This is free software; you can redistribute it and/or modify it under
285 the same terms as the Perl 5 programming language system itself.
286  
287 =cut
288  
289 __DATA__
↑ Summary