line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
our $VERSION = '0.4100'; # VERSION |
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GEEKRUTH'; # AUTHORITY |
4
|
|
|
|
|
|
|
# ABSTRACT: Trigger perlcritic alerts on deprecated Dancer2 keywords |
5
|
|
|
|
|
|
|
use 5.006001; |
6
|
3
|
|
|
3
|
|
1758
|
use strict; |
|
3
|
|
|
|
|
11
|
|
7
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
50
|
|
8
|
3
|
|
|
3
|
|
13
|
use Readonly; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
67
|
|
9
|
3
|
|
|
3
|
|
16
|
|
|
3
|
|
|
|
|
33
|
|
|
3
|
|
|
|
|
170
|
|
10
|
|
|
|
|
|
|
use Perl::Critic::Utils qw{ |
11
|
3
|
|
|
|
|
130
|
:booleans :characters :severities :classification :data_conversion |
12
|
|
|
|
|
|
|
}; |
13
|
3
|
|
|
3
|
|
22
|
use Perl::Critic::Utils::PPI qw{ is_ppi_expression_or_generic_statement }; |
|
3
|
|
|
|
|
7
|
|
14
|
3
|
|
|
3
|
|
1452
|
use base 'Perl::Critic::Policy'; |
|
3
|
|
|
|
|
27
|
|
|
3
|
|
|
|
|
149
|
|
15
|
3
|
|
|
3
|
|
18
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
916
|
|
16
|
|
|
|
|
|
|
|
17
|
4
|
|
|
4
|
1
|
41
|
Readonly::Hash my %deprecated_words => ( |
18
|
0
|
|
|
0
|
1
|
0
|
context => 'app', |
19
|
2
|
|
|
2
|
1
|
106250
|
header => 'response_header', |
20
|
|
|
|
|
|
|
headers => 'request_headers', |
21
|
|
|
|
|
|
|
push_header => 'push_response_header' |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => |
24
|
|
|
|
|
|
|
'You are using a Dancer2 keyword that is being or has been deprecated.'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my ( $self, $elem, $doc ) = @_; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $included = $doc->find_any( |
29
|
|
|
|
|
|
|
sub { |
30
|
|
|
|
|
|
|
$_[1]->isa('PPI::Statement::Include') |
31
|
62
|
|
|
62
|
1
|
1127
|
and defined( $_[1]->module() ) |
32
|
|
|
|
|
|
|
and ( $_[1]->module() eq 'Dancer2' ) |
33
|
|
|
|
|
|
|
and $_[1]->type() eq 'use'; |
34
|
|
|
|
|
|
|
} |
35
|
7334
|
50
|
66
|
7334
|
|
68805
|
); |
|
|
|
66
|
|
|
|
|
36
|
|
|
|
|
|
|
return if !$included; |
37
|
|
|
|
|
|
|
if ( defined $deprecated_words{$elem} ) { |
38
|
|
|
|
|
|
|
return if is_hash_key($elem); |
39
|
|
|
|
|
|
|
my $alternative = $deprecated_words{$elem}; |
40
|
62
|
|
|
|
|
236
|
my $desc = qq{Use '$alternative' instead of deprecated Dancer2 keyword '$elem'}; |
41
|
62
|
100
|
|
|
|
2321
|
return $self->violation( $desc, $EXPL, $elem ); |
42
|
32
|
100
|
|
|
|
62
|
} |
43
|
7
|
100
|
|
|
|
79
|
return; |
44
|
4
|
|
|
|
|
235
|
} |
45
|
4
|
|
|
|
|
44
|
|
46
|
4
|
|
|
|
|
26
|
1; |
47
|
|
|
|
|
|
|
|
48
|
25
|
|
|
|
|
269
|
|
49
|
|
|
|
|
|
|
=pod |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=encoding UTF-8 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Perl::Critic::Policy::Dancer2::ProhibitDeprecatedKeywords - Trigger perlcritic alerts on deprecated Dancer2 keywords |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 VERSION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
version 0.4100 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The L<Dancer2> team has a deprecation policy, detailed at |
64
|
|
|
|
|
|
|
L<Dancer2::DeprecationPolicy>, that will, in time, cause certain |
65
|
|
|
|
|
|
|
keywords to be removed from the Dancer2 codebase. You should not |
66
|
|
|
|
|
|
|
use these keywords, to prevent breaking your application when |
67
|
|
|
|
|
|
|
you update Dancer2 beyond that deprecation point. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AFFILIATION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This policy is part of L<Perl::Critic::Dancer2>. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 CONFIGURATION |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This Policy is not configurable except for the standard options. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
D Ruth Holloway <ruth@hiruthie.me> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This software is copyright (c) 2022 by D Ruth Holloway. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
88
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |