blib/lib/Perl/Critic/PolicyListing.pm

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