line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Critic::Policy::Bangs::ProhibitNoPlan; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1899
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
90
|
|
4
|
4
|
|
|
4
|
|
11
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
69
|
|
5
|
4
|
|
|
4
|
|
13
|
use Perl::Critic::Utils; |
|
4
|
|
|
|
|
2
|
|
|
4
|
|
|
|
|
45
|
|
6
|
4
|
|
|
4
|
|
1939
|
use base 'Perl::Critic::Policy'; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
783
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.11_03'; |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
0
|
13923
|
sub supported_parameters { return () } |
11
|
2
|
|
|
2
|
1
|
17
|
sub default_severity { return $SEVERITY_LOW } |
12
|
0
|
|
|
0
|
1
|
0
|
sub default_themes { return qw( bangs tests ) } |
13
|
2
|
|
|
2
|
1
|
7821
|
sub applies_to { return 'PPI::Token::QuoteLike::Words' } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub violates { |
18
|
4
|
|
|
4
|
1
|
178
|
my ( $self, $elem, $doc ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
4
|
100
|
|
|
|
15
|
if ( $elem =~ qr/\bno_plan\b/ ) { |
22
|
|
|
|
|
|
|
# Make sure that the previous sibling was Test::More, or return |
23
|
3
|
|
50
|
|
|
25
|
my $sib = $elem->sprevious_sibling() || return; |
24
|
3
|
100
|
66
|
|
|
74
|
$sib->isa('PPI::Token::Word') && $sib eq 'Test::More' || return; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
28
|
my $desc = q(Test::More with "no_plan" found); |
27
|
2
|
|
|
|
|
1
|
my $expl = q(Test::More should be given a plan indicating the number of tests run); |
28
|
2
|
|
|
|
|
10
|
return $self->violation( $desc, $expl, $elem ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
9
|
return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Perl::Critic::Policy::Bangs::ProhibitNoPlan - Know what you're going to test. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 AFFILIATION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This Policy is part of the L<Perl::Critic::Bangs> distribution. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 DESCRIPTION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Test::More should be given a plan indicting the number of tests to be |
48
|
|
|
|
|
|
|
run. This policy searches for instances of Test::More called with |
49
|
|
|
|
|
|
|
"no_plan". |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 CONFIGURATION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This Policy is not configurable except for the standard options. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Andrew Moore <amoore@mooresystems.com> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 ACKNOWLEDGMENTS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Adapted from policies by Jeffrey Ryan Thalhammer <thaljef@cpan.org>, |
62
|
|
|
|
|
|
|
Based on App::Fluff by Andy Lester, "<andy at petdance.com>" |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 COPYRIGHT |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Copyright (c) 2006-2013 Andy Lester <andy@petdance.com> and Andrew |
67
|
|
|
|
|
|
|
Moore <amoore@mooresystems.com> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it |
70
|
|
|
|
|
|
|
under the terms of the Artistic License 2.0. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |