File Coverage

blib/lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm
Criterion Covered Total %
statement 25 25 100.0
branch 4 4 100.0
condition n/a
subroutine 11 11 100.0
pod 4 5 80.0
total 44 45 97.7


line stmt bran cond sub pod time code
1             package Perl::Critic::Policy::Miscellanea::ProhibitFormats;
2              
3 40     40   26656 use 5.010001;
  40         187  
4 40     40   268 use strict;
  40         157  
  40         908  
5 40     40   605 use warnings;
  40         110  
  40         1017  
6 40     40   235 use Readonly;
  40         107  
  40         2076  
7              
8 40     40   281 use Perl::Critic::Utils qw{ :severities :classification };
  40         731  
  40         2101  
9 40     40   14247 use parent 'Perl::Critic::Policy';
  40         149  
  40         270  
10              
11             our $VERSION = '1.146';
12              
13             #-----------------------------------------------------------------------------
14              
15             Readonly::Scalar my $DESC => q{Format used};
16             Readonly::Scalar my $EXPL => [ 449 ];
17              
18             #-----------------------------------------------------------------------------
19              
20 91     91 0 1624 sub supported_parameters { return () }
21 78     78 1 328 sub default_severity { return $SEVERITY_MEDIUM }
22 86     86 1 389 sub default_themes { return qw( core maintenance pbp certrule ) }
23 32     32 1 110 sub applies_to { return 'PPI::Token::Word' }
24              
25             #-----------------------------------------------------------------------------
26              
27             sub violates {
28 347     347 1 630 my ( $self, $elem, undef ) = @_;
29 347 100       699 return if $elem->content() ne 'format';
30 7 100       47 return if ! is_function_call( $elem );
31 4         25 return $self->violation( $DESC, $EXPL, $elem );
32             }
33              
34              
35             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 :