PluginBundle/PERLSRVDE.pm

filter: Statementstmt 57.1% 100 / 175 Branchbran 0.0% 0 / 66 Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 63.6% 28 / 44 Podpod 0.0% 0 / 1 totaltotal 42.3% 128 / 302 CC 40 SCAR 38.2
CC
40
Cov
40%
_meta_resources
182.0
configure
110.0
__ANON__
12.0
CRAP 45.4
↑ Summary PERLSRVDE.pm »
1 package Dist::Zilla::PluginBundle::PERLSRVDE;
2  
3 1 ▶use v5.24;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # ABSTRACT: The plugin bundle we use at Perl-Services.de
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '1.1.1'; # VERSION
11  
12 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Dist::Zilla 6.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use Dist::Zilla::PluginBundle::Git;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Dist::Zilla::PluginBundle::Basic;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Dist::Zilla::PluginBundle::Filter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Dist::Zilla::Plugin::ContributorsFile;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Dist::Zilla::Plugin::CheckChangesHasContent;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Dist::Zilla::Plugin::NextRelease;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Dist::Zilla::Plugin::SyncCPANfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Dist::Zilla::Plugin::OurPkgVersion;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Dist::Zilla::Plugin::PodWeaver;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use Dist::Zilla::Plugin::Git::Contributors;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use Dist::Zilla::Plugin::PodSyntaxTests;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use Dist::Zilla::Plugin::Test::NoTabs;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use Dist::Zilla::Plugin::Test::NoBOM;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶use Dist::Zilla::Plugin::Test::Perl::Critic;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 1 ▶use Dist::Zilla::Plugin::ExecDir;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 1 ▶use Dist::Zilla::Plugin::MetaJSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 1 ▶use Dist::Zilla::Plugin::MetaProvides::Package;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 1 ▶use Dist::Zilla::Plugin::ReadmeAnyFromPod;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 1 ▶use Dist::Zilla::Plugin::ReadmeAddDevInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 1 ▶use Dist::Zilla::Plugin::GitHubREADME::Badge;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 ▶use Dist::Zilla::Plugin::MetaResources;
Subroutine BEGIN: called CC=1 SCAR=0.0
39  
40 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 1 with qw(
43 Dist::Zilla::Role::PluginBundle::Easy
44 Dist::Zilla::Role::PluginBundle::Config::Slicer
45 Dist::Zilla::Role::PluginBundle::PluginRemover
46 );
47  
48 has 'is_cpan' => (
49 is => 'ro',
50 isa => 'Bool',
51 lazy => 1,
52 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
53 0 my $pl = $_[0]->payload;
54 0 ▶ exists $pl->{is_cpan} ? $pl->{is_cpan} : 0;
Branch: 1 branch
BranchTrueFalseTotal
exists $pl->{'is_cpan'} ? : 0 0 0
55 },
56 1 );
57  
58 has 'repository_type' => (
59 is => 'ro',
60 isa => 'Str',
61 lazy => 1,
62 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
63 0 my $pl = $_[0]->payload;
64 0 ▶ exists $pl->{repository_type} ? $pl->{repository_type} : 'github';
Branch: 1 branch
BranchTrueFalseTotal
exists $pl->{'repository_type'} ? : 0 0 0
65 },
66 1 );
67  
68 has 'repository_path' => (
69 is => 'ro',
70 isa => 'Str',
71 lazy => 1,
72 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
73 0 my $pl = $_[0]->payload;
74 0 ▶ exists $pl->{repository_path} ? $pl->{repository_path} : '';
Branch: 1 branch
BranchTrueFalseTotal
exists $pl->{'repository_path'} ? : 0 0 0
75 },
76 1 );
77  
78 has 'internal_type' => (
79 is => 'ro',
80 isa => 'Str',
81 lazy => 1,
82 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
83 0 my $pl = $_[0]->payload;
84 0 ▶ exists $pl->{internal_type} ? $pl->{internal_type} : 'git';
Branch: 1 branch
BranchTrueFalseTotal
exists $pl->{'internal_type'} ? : 0 0 0
85 },
86 1 );
87  
88 has 'internal_url' => (
89 is => 'ro',
90 isa => 'Str',
91 lazy => 1,
92 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
93 0 my $pl = $_[0]->payload;
94 0 ▶ exists $pl->{internal_url} ? $pl->{internal_url} : '';
Branch: 1 branch
BranchTrueFalseTotal
exists $pl->{'internal_url'} ? : 0 0 0
95 },
96 1 );
97  
98 has 'internal_web' => (
99 is => 'ro',
100 isa => 'Str',
101 lazy => 1,
102 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
103 0 my $pl = $_[0]->payload;
104 0 ▶ exists $pl->{internal_web} ? $pl->{internal_web} : '';
Branch: 1 branch
BranchTrueFalseTotal
exists $pl->{'internal_web'} ? : 0 0 0
105 },
106 1 );
107  
108 has 'bugtracker' => (
109 is => 'ro',
110 isa => 'Str',
111 lazy => 1,
112 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
113 0 my $pl = $_[0]->payload;
114 0 ▶ exists $pl->{bugtracker} ? $pl->{bugtracker} : '';
Branch: 1 branch
BranchTrueFalseTotal
exists $pl->{'bugtracker'} ? : 0 0 0
115 },
116 1 );
117  
118 has 'pod_class' => (
119 is => 'ro',
120 isa => 'Str',
121 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
122 0 my $pl = $_[0]->payload;
123 0 ▶ exists $pl->{pod_class} ? $pl->{pod_class} : 'Pod::Coverage::TrustPod';
Branch: 1 branch
BranchTrueFalseTotal
exists $pl->{'pod_class'} ? : 0 0 0
124 },
125 1 );
126  
127 has 'pod_skip' => (
128 is => 'ro',
129 isa => 'ArrayRef',
130 0 ▶ default => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
131 0 my $pl = $_[0]->payload;
132 exists $pl->{pod_skip} ?
133 0 ▶ ref $pl->{pod_skip} ? $pl->{pod_skip} : [ $pl->{pod_skip} ]
Branch: 2 branches
BranchTrueFalseTotal
exists $pl->{'pod_skip'} ? : 0 0 0
ref $pl->{'pod_skip'} ? : 0 0 0
134 : [];
135 },
136 1 );
137  
138 has 'pod_trustme' => (
139 is => 'ro',
140 isa => 'ArrayRef',
141 0 ▶ default => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
142 0 my $pl = $_[0]->payload;
143 exists $pl->{pod_trustme} ?
144 0 ▶ ref $pl->{pod_trustme} ? $pl->{pod_trustme} : [ $pl->{pod_trustme} ]
Branch: 2 branches
BranchTrueFalseTotal
exists $pl->{'pod_trustme'} ? : 0 0 0
ref $pl->{'pod_trustme'} ? : 0 0 0
145 : [];
146 },
147 1 );
148  
149 has 'pod_also_private' => (
150 is => 'ro',
151 isa => 'ArrayRef',
152 0 ▶ default => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
153 0 my $pl = $_[0]->payload;
154 exists $pl->{pod_also_private} ?
155 0 ▶ ref $pl->{pod_also_private} ? $pl->{pod_also_private} : [ $pl->{pod_also_private} ]
Branch: 2 branches
BranchTrueFalseTotal
exists $pl->{'pod_also_private'} ? : 0 0 0
ref $pl->{'pod_also_private'} ? : 0 0 0
156 : [];
157 },
158 1 );
159  
160 has 'fake_release' => (
161 is => 'ro',
162 isa => 'Bool',
163 lazy => 1,
164 0 ▶ default => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
165 0 my $pl = $_[0]->payload;
166 0 ▶ if ( $pl->{is_cpan} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pl->{"is_cpan"}) 0 0 0
167 0 $pl->{fake_release} = 0;
168 }
169 0 ▶ exists $pl->{fake_release} ? $pl->{fake_release} : 1;
Branch: 1 branch
BranchTrueFalseTotal
exists $pl->{'fake_release'} ? : 0 0 0
170 },
171 1 );
172  
173 has exclude_from_basic => (
174 is => 'ro',
175 isa => 'ArrayRef[Str]',
176 lazy => 1,
177 0 ▶ default => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
178 0 my $pl = $_[0]->payload;
179 0 my $exclude = $pl->{exclude_from_basic};
180 0 ▶ $exclude ?
Branch: 2 branches
BranchTrueFalseTotal
$exclude ? : 0 0 0
ref $exclude ? : 0 0 0
181 ref $exclude ? $exclude : [ $exclude ]
182 : []
183 },
184 1 );
185  
186 0 ▶sub mvp_multivalue_args {
Subroutine mvp_multivalue_args: not called CC=1 SCAR=6.9
187 0 return qw( pod_skip pod_trustme pod_also_private exclude_from_basic );
188 }
189  
190 0 ▶sub configure {
Subroutine configure: not called CC=10 SCAR=47.0
Pod undocumented
191 0 my ($self) = @_;
192  
193 0 my %remove_from_basic;
194 0 ▶ if ( $self->fake_release ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->fake_release) 0 0 0
195 0 $remove_from_basic{UploadToCPAN}++;
196 }
197  
198 0 ▶ for my $exclude ( @{ $self->exclude_from_basic || [] } ) {
Condition0%0/2
$self->exclude_from_basic || []
l!l
00
MC/DC0%0/1
$self->exclude_from_basic || []
$self->exclude_from_basic
Truth table0%0/2
A
A= $self->exclude_from_basic
Aresult
11
00
199 0 $remove_from_basic{$exclude}++;
200 }
201  
202 0 my %pod_coverage_opts;
203 0 for my $opt_name ( qw/class skip trustme also_private/ ) {
204 0 my $method = $self->can('pod_' . $opt_name);
205 0 ▶ next if !$method;
Branch: 1 branch
BranchTrueFalseTotal
unless $method 0 0 0
206  
207 0 my $value = $self->$method();
208 0 ▶ next if !$value;
Branch: 1 branch
BranchTrueFalseTotal
unless $value 0 0 0
209 0 ▶ next if ref $value && !@{ $value };
Branch: 1 branch
BranchTrueFalseTotal
if ref $value and not @{$value;} 0 0 0
Condition0%0/3
ref $value and not @{$value;}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $value and not @{$value;}
ref $value not @{$value;}
Truth table0%0/3
A and not(B)
A= ref $valueB= not @{$value;}
ABresult
0X0
100
111
210  
211 0 $pod_coverage_opts{$opt_name} = $value;
212 }
213  
214 $self->add_plugins(
215 [
216 0 'ContributorsFile' => {
217 filename => 'CONTRIBUTORS',
218 },
219 ],
220 'CheckChangesHasContent',
221 [
222 'NextRelease' => {
223 format => '%-9v%T %{yyyy-MM-dd HH:mm:ss VVVV}d',
224 },
225 ],
226 qw/
227 SyncCPANfile
228 OurPkgVersion
229 PodWeaver
230 /,
231 [
232 'Git::Contributors' => {
233 include_authors => 1,
234 },
235 ],
236 [
237 'Test::Pod::Coverage::Configurable' => \%pod_coverage_opts,
238 ],
239 qw/
240 PodSyntaxTests
241  
242 Test::NoTabs
243 Test::NoBOM
244 Test::Perl::Critic
245  
246 MetaJSON
247 MetaProvides::Package
248  
249 ExecDir
250 /,
251 );
252  
253 0 $self->add_bundle(
254 '@Filter' => {
255 '-bundle' => '@Basic',
256 '-remove' => [ 'Readme', 'PodCoverageTest', sort keys %remove_from_basic ],
257 },
258 );
259  
260 0 $self->_meta_resources;
261 0 $self->add_bundle('@Git');
262  
263 0 ▶ if ( $self->is_cpan ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_cpan) 0 0 0
264 0 $self->add_plugins(
265 [
266 'ReadmeAnyFromPod' => 'GfmInRoot' => {
267 phase => 'build',
268 },
269 ],
270 [
271 'ReadmeAnyFromPod' => 'TextInBuild' => {
272 phase => 'build',
273 },
274 ],
275 [
276 'ReadmeAddDevInfo' => {
277 phase => 'build',
278 before => '# AUTHOR',
279 add_contribution_file => 1,
280 },
281 ],
282 [
283 'GitHubREADME::Badge' => {
284 badges => [ qw/cpants issues cpancover license/ ],
285 phase => 'build',
286 place => 'top',
287 },
288 ],
289 );
290 }
291 }
292  
293 0 ▶sub _meta_resources {
Subroutine _meta_resources: not called CC=13 SCAR=52.0
294 0 my ($self) = @_;
295  
296 0 my %meta_resources;
297  
298 0 ▶ $meta_resources{'bugtracker.web'} = $self->bugtracker if $self->bugtracker;
Branch: 1 branch
BranchTrueFalseTotal
if $self->bugtracker 0 0 0
299  
300 0 my $type = $self->repository_type;
301  
302 0 ▶ return if !$type && !%meta_resources;
Branch: 1 branch
BranchTrueFalseTotal
unless $type or %meta_resources 0 0 0
Condition0%0/3
$type or %meta_resources
l!l&&r!l&&!r
000
MC/DC0%0/2
$type or %meta_resources
$type %meta_resources
Truth table0%0/3
A or B
A= $typeB= %meta_resources
ABresult
1X1
011
000
303  
304 0 my $name = $self->repository_path;
305  
306 0 ▶ if ( $type eq 'github' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($type eq 'github') { } 0 0 0
elsif ($type eq 'gitlab') { } 0 0 0
elsif ($type eq 'internal') { } 0 0 0
307 $meta_resources{'homepage'} =
308 0 $meta_resources{'repository.web'} =
309 sprintf "https://github.com/%s",
310 $name
311 ;
312 0 $meta_resources{'repository.url'} =
313 sprintf "git://github.com/%s.git",
314 $name
315 ;
316 0 $meta_resources{'repository.type'} = 'git';
317  
318 0 ▶ if ( !$self->bugtracker ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->bugtracker) 0 0 0
319 0 $meta_resources{'bugtracker.web'} =
320 sprintf "https://github.com/%s/issues",
321 $name
322 ;
323 }
324 }
325 elsif ( $type eq 'gitlab' ) {
326 $meta_resources{'homepage'} =
327 0 $meta_resources{'repository.web'} =
328 sprintf "https://gitlab.com/%s",
329 $name
330 ;
331 0 $meta_resources{'repository.url'} =
332 sprintf "git://gitlab.com/%s.git",
333 $name
334 ;
335 0 $meta_resources{'repository.type'} = 'git';
336  
337 0 ▶ if ( !$self->bugtracker ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->bugtracker) 0 0 0
338 0 $meta_resources{'bugtracker.web'} =
339 sprintf "https://gitlab.com/%s/-/issues",
340 $name
341 ;
342 }
343 }
344 elsif ( $type eq 'internal' ) {
345 $meta_resources{'homepage'} =
346 0 ▶ $meta_resources{'repository.web'} =
Branch: 1 branch
BranchTrueFalseTotal
if $self->internal_web 0 0 0
347 $self->internal_web if $self->internal_web;
348 0 ▶ $meta_resources{'repository.url'} =
Branch: 1 branch
BranchTrueFalseTotal
if $self->internal_url 0 0 0
349 $self->internal_url if $self->internal_url;
350 0 ▶ $meta_resources{'repository.type'} =
Condition0%0/2
$self->internal_type || 'git'
l!l
00
MC/DC0%0/1
$self->internal_type || 'git'
$self->internal_type
Truth table0%0/2
A
A= $self->internal_type
Aresult
11
00
351 $self->internal_type || 'git';
352 }
353  
354 0 ▶ return if !%meta_resources;
Branch: 1 branch
BranchTrueFalseTotal
unless %meta_resources 0 0 0
355  
356 0 $self->add_plugins(
357 [ 'MetaResources' => \%meta_resources ],
358 );
359  
360 0 return 1;
361 }
362  
363 1 __PACKAGE__->meta->make_immutable;
364  
365 1 1;
366  
367 __END__
↑ Summary PERLSRVDE.pm »