blib/lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm

filter: Statementstmt 93.1% 27 / 29 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 80.0% 4 / 5 totaltotal 87.7% 43 / 49 CC 3 SCAR 6.8
CC
3
Cov
85%
violates
5.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« blib/lib/Perl/Critic/Policy/Subroutines/ProhibitExcessComplexity.pm ↑ Summary blib/lib/Perl/Critic/Policy/Miscellanea/ProhibitTies.pm »
1 package Perl::Critic::Policy::Miscellanea::ProhibitFormats;
2  
3 40 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 40 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 40 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 40 ▶use Perl::Critic::Utils qw{ :severities :classification };
Subroutine BEGIN: called CC=1 SCAR=0.0
9 40 ▶use parent 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 40 our $VERSION = '1.150';
12  
13 #-----------------------------------------------------------------------------
14  
15 40 Readonly::Scalar my $DESC => q{Format used};
16 40 Readonly::Scalar my $EXPL => [ 449 ];
17  
18 #-----------------------------------------------------------------------------
19  
20 90 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
21 75 ▶sub default_severity { return $SEVERITY_MEDIUM }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
22 86 ▶sub default_themes { return qw( core maintenance pbp certrule ) }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
23 31 ▶sub applies_to { return 'PPI::Token::Word' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
24  
25 #-----------------------------------------------------------------------------
26  
27 sub violates {
28 332 ▶ my ( $self, $elem, undef ) = @_;
Subroutine violates: called CC=3 SCAR=16.5
Pod documented
29 332 ▶ return if $elem->content() ne 'format';
Branch: 1 branch
BranchTrueFalseTotal
if $elem->content ne "format" 332 0 332
30 0 ▶ return if ! is_function_call( $elem );
Branch: 1 branch
BranchTrueFalseTotal
unless is_function_call($elem) 0 0 0
31 0 return $self->violation( $DESC, $EXPL, $elem );
32 }
33  
34  
35 40 1;
36  
37 __END__
38  
39 #-----------------------------------------------------------------------------
40  
41 =pod
42  
43 =head1 NAME
44  
45 Perl::Critic::Policy::Miscellanea::ProhibitFormats - Do not use C<format>.
46  
47  
48 =head1 AFFILIATION
49  
50 This Policy is part of the core L<Perl::Critic|Perl::Critic>
51 distribution.
52  
53  
54 =head1 DESCRIPTION
55  
56 Formats are one of the oldest features of Perl. Unfortunately, they
57 suffer from several limitations. Formats are static and cannot be
58 easily defined at run time. Also, formats depend on several obscure
59 global variables.
60  
61 For more modern reporting tools, consider using one of the template
62 frameworks like L<Template|Template> or try the
63 L<Perl6::Form|Perl6::Form> module.
64  
65  
66 =head1 CONFIGURATION
67  
68 This Policy is not configurable except for the standard options.
69  
70  
71 =head1 AUTHOR
72  
73 Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
74  
75 =head1 COPYRIGHT
76  
77 Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
78  
79 This program is free software; you can redistribute it and/or modify
80 it under the same terms as Perl itself. The full text of this license
81 can be found in the LICENSE file included with this module.
82  
83 =cut
84  
85 # Local Variables:
86 # mode: cperl
87 # cperl-indent-level: 4
88 # fill-column: 78
89 # indent-tabs-mode: nil
90 # c-indentation-style: bsd
91 # End:
92 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
« blib/lib/Perl/Critic/Policy/Subroutines/ProhibitExcessComplexity.pm ↑ Summary blib/lib/Perl/Critic/Policy/Miscellanea/ProhibitTies.pm »