blib/lib/Perl/Critic/ThemeListing.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 94.2% 33 / 35 CC 3 SCAR 4.1
CC
3
Cov
96%
new
2.0
to_string
2.0
BEGIN
1.0
CRAP 1.5
« blib/lib/Perl/Critic/Policy/Modules/ProhibitMultiplePackages.pm ↑ Summary blib/lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm »
1 package Perl::Critic::ThemeListing;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use overload ( q<""> => 'to_string' );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = '1.150';
10  
11 #-----------------------------------------------------------------------------
12  
13 sub new {
14 1 ▶ my ($class, %args) = @_;
Subroutine new: called CC=2 SCAR=7.0
Pod documented
15  
16 1 my $self = bless {}, $class;
17  
18 1 ▶ $self->{_policies} = $args{-policies} || [];
Condition50%1/2
$args{'-policies'} || []
l!l
10
MC/DC0%0/1
$args{'-policies'} || []
$args{'-policies'}
Truth table50%1/2
A
A= $args{'-policies'}
Aresult
11
00
19  
20 1 return $self;
21 }
22  
23 #-----------------------------------------------------------------------------
24  
25 sub to_string {
26 1 ▶ my ($self) = @_;
Subroutine to_string: called CC=2 SCAR=6.9
Pod documented
27  
28 1 my %themes;
29 1 foreach my $policy ( @{ $self->{_policies} } ) {
30 145 my @themes = $policy->get_themes();
31 145 @themes{ @themes } = @themes;
32 }
33  
34 1 return join ("\n", sort keys %themes) . "\n";
35 }
36  
37 #-----------------------------------------------------------------------------
38  
39 1 1;
40  
41 __END__
42  
43 =pod
44  
45 =head1 NAME
46  
47 Perl::Critic::ThemeListing - List the themes of the installed Policies.
48  
49  
50 =head1 DESCRIPTION
51  
52 This is a helper class that gathers the themes of the installed
53 Policies. There are no user-serviceable parts here.
54  
55  
56 =head1 INTERFACE SUPPORT
57  
58 This is considered to be a non-public class. Its interface is subject
59 to change without notice.
60  
61  
62 =head1 CONSTRUCTOR
63  
64 =over
65  
66 =item C<< new( -policies => \@POLICY_OBJECTS ) >>
67  
68 Returns a reference to a new C<Perl::Critic::ThemeListing> object.
69  
70  
71 =back
72  
73  
74 =head1 METHODS
75  
76 =over
77  
78  
79 =item to_string()
80  
81 Returns a string representation of this C<ThemeListing>. See
82 L<"OVERLOADS"> for more information.
83  
84  
85 =back
86  
87  
88 =head1 OVERLOADS
89  
90  
91 When a L<Perl::Critic::ThemeListing|Perl::Critic::ThemeListing> is
92 evaluated in string context, it produces a one-line summary of the
93 default severity, policy name, and default themes for each
94 L<Perl::Critic::Policy|Perl::Critic::Policy> object that was given to
95 the constructor of this C<ThemeListing>.
96  
97  
98 =head1 AUTHOR
99  
100 Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
101  
102  
103 =head1 COPYRIGHT
104  
105 Copyright (c) 2005-2023 Imaginative Software Systems
106  
107 This program is free software; you can redistribute it and/or modify
108 it under the same terms as Perl itself. The full text of this license
109 can be found in the LICENSE file included with this module.
110  
111 =cut
112  
113 # Local Variables:
114 # mode: cperl
115 # cperl-indent-level: 4
116 # fill-column: 78
117 # indent-tabs-mode: nil
118 # c-indentation-style: bsd
119 # End:
120 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
« blib/lib/Perl/Critic/Policy/Modules/ProhibitMultiplePackages.pm ↑ Summary blib/lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm »