blib/lib/Dist/Zilla/Plugin/Test/Perl/Critic/Freenode.pm

filter: Statementstmt 100% 43 / 43 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 2 totaltotal 89.0% 57 / 64 CC 4 SCAR 6.2
CC
4
Cov
94%
gather_files
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
↑ Summary
1 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Dist::Zilla::Plugin::Test::Perl::Critic::Freenode;
6 # ABSTRACT: Tests to check your code against policies inspired by #perl on Freenode
7 1 $Dist::Zilla::Plugin::Test::Perl::Critic::Freenode::VERSION = '0.002';
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Moose::Util qw( get_all_attribute_values );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Dist::Zilla::File::InMemory;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Sub::Exporter::ForMethods 'method_installer';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Data::Section 0.004 { installer => method_installer }, '-setup';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # and when the time comes, treat them like templates
17 1 with qw(
18 Dist::Zilla::Role::FileGatherer
19 Dist::Zilla::Role::TextTemplate
20 Dist::Zilla::Role::PrereqSource
21 );
22  
23 1 ▶sub gather_files {
Subroutine gather_files: called CC=4 SCAR=14.3
Pod undocumented
24 1 my ($self) = @_;
25  
26 1 my $data = $self->merged_section_data;
27 1 ▶ return unless $data and %$data;
Branch: 1 branch
BranchTrueFalseTotal
unless $data and %$data 0 1 1
Condition33%1/3
$data and %$data
!ll&&!rl&&r
001
MC/DC0%0/2
$data and %$data
$data %$data
Truth table33%1/3
A and B
A= $dataB= %$data
ABresult
0X0
100
111
28  
29 1 my $stash = get_all_attribute_values( $self->meta, $self);
30  
31 # NB: This code is a bit generalised really, and could be forked into its
32 # own plugin.
33 1 for my $name ( keys %$data ){
34 1 my $template = ${$data->{$name}};
35 1 $self->add_file( Dist::Zilla::File::InMemory->new({
36 name => $name,
37 content => $self->fill_in_string( $template, $stash )
38 }));
39 }
40 }
41  
42 1 ▶sub register_prereqs {
Subroutine register_prereqs: called CC=1 SCAR=0.0
Pod undocumented
43 1 my $self = shift;
44  
45 1 $self->zilla->register_prereqs(
46 {
47 type => 'requires',
48 phase => 'develop',
49 },
50 'Test::Perl::Critic' => 0,
51 'Perl::Critic::Freenode' => 0,
52  
53 # TODO also extract list of policies used in file $self->critic_config
54 );
55 }
56  
57 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 1 __PACKAGE__->meta->make_immutable;
59 1 1;
60  
61 =pod
62  
63 =encoding UTF-8
64  
65 =head1 NAME
66  
67 Dist::Zilla::Plugin::Test::Perl::Critic::Freenode - Tests to check your code against policies inspired by #perl on Freenode
68  
69 =head1 VERSION
70  
71 version 0.002
72  
73 =head1 SYNOPSIS
74  
75 In your F<dist.ini>:
76  
77 [Test::Perl::Critic::Freenode]
78  
79 =head1 DESCRIPTION
80  
81 This will provide a F<xt/author/critic-freenode.t> file for use during the
82 "test" and "release" calls of C<dzil>. To use this, make the changes to
83 F<dist.ini> above and run one of the following:
84  
85 dzil test
86 dzil release
87  
88 During these runs, F<xt/author/critic-freenode.t> will use
89 L<Test::Perl::Critic> to run L<Perl::Critic> against your code and report its
90 findings.
91  
92 This plugin is an extension of L<Dist::Zilla::Plugin::InlineFiles>.
93  
94 This plugin is a fork of L<Dist::Zilla::Plugin::Test::Perl::Critic>.
95  
96 =for Pod::Coverage gather_files register_prereqs
97  
98 =head1 SEE ALSO
99  
100 You can look for information on this module at:
101  
102 =for stopwords AnnoCPAN
103  
104 =over 4
105  
106 =item * Search CPAN
107  
108 L<http://search.cpan.org/dist/Dist-Zilla-Plugin-Test-Perl-Critic-Freenode>
109  
110 =item * See open / report bugs
111  
112 L<https://github.com/pink-mist/Dist-Zilla-Plugin-Test-Perl-Critic-Freenode/issues>
113  
114 =item * Git repository
115  
116 L<https://github.com/pink-mist/Dist-Zilla-Plugin-Test-Perl-Critic-Freenode>
117  
118 =item * AnnoCPAN: Annotated CPAN documentation
119  
120 L<http://annocpan.org/dist/Dist-Zilla-Plugin-Test-Perl-Critic-Freenode>
121  
122 =item * CPAN Ratings
123  
124 L<http://cpanratings.perl.org/d/Dist-Zilla-Plugin-Test-Perl-Critic-Freenode>
125  
126 =back
127  
128 =head1 ORIGINAL AUTHOR
129  
130 Original author of L<Dist::Zilla::Plugin::Test::Perl::Critic> is Jerome Quelin
131  
132 =head1 AUTHOR
133  
134 Andreas Guldstrand
135  
136 =head1 COPYRIGHT AND LICENSE
137  
138 This software is copyright (c) 2017 by Andreas Guldstrand.
139  
140 This is free software; you can redistribute it and/or modify it under
141 the same terms as the Perl 5 programming language system itself.
142  
143 =cut
144  
145 __DATA__
↑ Summary