line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Critic::Policy::ControlStructures::ProhibitYadaOperator; |
2
|
|
|
|
|
|
|
|
3
|
40
|
|
|
40
|
|
27187
|
use 5.010001; |
|
40
|
|
|
|
|
182
|
|
4
|
40
|
|
|
40
|
|
260
|
use strict; |
|
40
|
|
|
|
|
110
|
|
|
40
|
|
|
|
|
872
|
|
5
|
40
|
|
|
40
|
|
230
|
use warnings; |
|
40
|
|
|
|
|
134
|
|
|
40
|
|
|
|
|
980
|
|
6
|
40
|
|
|
40
|
|
224
|
use Readonly; |
|
40
|
|
|
|
|
120
|
|
|
40
|
|
|
|
|
2193
|
|
7
|
|
|
|
|
|
|
|
8
|
40
|
|
|
40
|
|
313
|
use Perl::Critic::Utils qw{ :characters :severities }; |
|
40
|
|
|
|
|
152
|
|
|
40
|
|
|
|
|
2082
|
|
9
|
40
|
|
|
40
|
|
12011
|
use parent 'Perl::Critic::Policy'; |
|
40
|
|
|
|
|
113
|
|
|
40
|
|
|
|
|
286
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.146'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{yada operator (...) used}; |
16
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => q{The yada operator is a placeholder for code you have not yet written.}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
19
|
|
|
|
|
|
|
|
20
|
92
|
|
|
92
|
0
|
1630
|
sub supported_parameters { return () } |
21
|
76
|
|
|
76
|
1
|
324
|
sub default_severity { return $SEVERITY_HIGH } |
22
|
86
|
|
|
86
|
1
|
370
|
sub default_themes { return qw( core pbp maintenance ) } |
23
|
35
|
|
|
35
|
1
|
127
|
sub applies_to { return 'PPI::Token::Operator' } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub violates { |
28
|
146
|
|
|
146
|
1
|
310
|
my ( $self, $elem, undef ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
146
|
100
|
|
|
|
320
|
if ( _is_yada( $elem ) ) { |
31
|
2
|
|
|
|
|
12
|
return $self->violation( $DESC, $EXPL, $elem ); |
32
|
|
|
|
|
|
|
} |
33
|
144
|
|
|
|
|
2325
|
return; #ok! |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _is_yada { |
37
|
146
|
|
|
146
|
|
299
|
my ( $elem ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
146
|
100
|
|
|
|
332
|
return if $elem ne '...'; |
40
|
|
|
|
|
|
|
#return if not defined $elem->statement; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# if there is something significant on both sides of the element it's |
43
|
|
|
|
|
|
|
# probably the three dot range operator |
44
|
7
|
100
|
66
|
|
|
134
|
return if ($elem->snext_sibling and $elem->sprevious_sibling); |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
94
|
return 1; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=for stopwords yada Berndt |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Perl::Critic::Policy::ControlStructures::ProhibitYadaOperator - Never use C<...> in production code. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AFFILIATION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This Policy is part of the core L<Perl::Critic|Perl::Critic> |
66
|
|
|
|
|
|
|
distribution. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DESCRIPTION |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The yada operator C<...> is not something you'd want in production |
72
|
|
|
|
|
|
|
code because it will throw an exception when executed. However, it is |
73
|
|
|
|
|
|
|
perfectly useful in less critical environments as a placeholder for code |
74
|
|
|
|
|
|
|
not yet implemented. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 CONFIGURATION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This Policy is not configurable except for the standard options. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Alan Berndt <alan@eatabrick.org> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Copyright (c) 2015-2017 Alan Berndt. All rights reserved. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
89
|
|
|
|
|
|
|
it under the same terms as Perl itself. The full text of this license |
90
|
|
|
|
|
|
|
can be found in the LICENSE file included with this module. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# Local Variables: |
95
|
|
|
|
|
|
|
# mode: cperl |
96
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
97
|
|
|
|
|
|
|
# fill-column: 78 |
98
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
99
|
|
|
|
|
|
|
# c-indentation-style: bsd |
100
|
|
|
|
|
|
|
# End: |
101
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |