line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
our $VERSION = '0.4000'; # VERSION |
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GEEKRUTH'; # AUTHORITY |
4
|
|
|
|
|
|
|
# ABSTRACT: Trigger perlcritic alerts on unrecommended Dancer2 keywords |
5
|
|
|
|
|
|
|
use 5.006001; |
6
|
2
|
|
|
2
|
|
684639
|
use strict; |
|
2
|
|
|
|
|
26
|
|
7
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
38
|
|
8
|
2
|
|
|
2
|
|
8
|
use Readonly; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
9
|
2
|
|
|
2
|
|
9
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
124
|
|
10
|
|
|
|
|
|
|
use Perl::Critic::Utils qw{ |
11
|
2
|
|
|
|
|
122
|
:booleans :characters :severities :classification :data_conversion |
12
|
|
|
|
|
|
|
}; |
13
|
2
|
|
|
2
|
|
11
|
use base 'Perl::Critic::Policy'; |
|
2
|
|
|
|
|
5
|
|
14
|
2
|
|
|
2
|
|
1072
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1073
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
1
|
13
|
Readonly::Hash my %unrecommended_words => |
17
|
0
|
|
|
0
|
1
|
0
|
( { params => q{body_parameters', 'route_parameters', or 'query_parameters} }, ); |
18
|
2
|
|
|
2
|
1
|
42920
|
Readonly::Scalar my $EXPL => |
19
|
|
|
|
|
|
|
'You are using a Dancer2 keyword that is not recommended, and may be deprecated in the future.'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my ( $self, $elem, $doc ) = @_; |
22
|
|
|
|
|
|
|
my $included = $doc->find_any( |
23
|
|
|
|
|
|
|
sub { |
24
|
|
|
|
|
|
|
$_[1]->isa('PPI::Statement::Include') |
25
|
|
|
|
|
|
|
and defined( $_[1]->module() ) |
26
|
26
|
|
|
26
|
1
|
131
|
and ( $_[1]->module() eq 'Dancer2' ) |
27
|
|
|
|
|
|
|
and $_[1]->type() eq 'use'; |
28
|
|
|
|
|
|
|
} |
29
|
910
|
100
|
66
|
910
|
|
8898
|
); |
|
|
|
100
|
|
|
|
|
30
|
|
|
|
|
|
|
return if !$included; |
31
|
|
|
|
|
|
|
if ( defined $unrecommended_words{$elem} ) { |
32
|
|
|
|
|
|
|
my $alternative = $unrecommended_words{$elem}; |
33
|
|
|
|
|
|
|
my $desc = qq{Use '$alternative' instead of unrecommended Dancer2 keyword '$elem'}; |
34
|
26
|
|
|
|
|
88
|
return $self->violation( $desc, $EXPL, $elem ); |
35
|
26
|
100
|
|
|
|
914
|
} |
36
|
13
|
100
|
|
|
|
26
|
return; |
37
|
1
|
|
|
|
|
11
|
} |
38
|
1
|
|
|
|
|
12
|
|
39
|
1
|
|
|
|
|
11
|
1; |
40
|
|
|
|
|
|
|
|
41
|
12
|
|
|
|
|
130
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=encoding UTF-8 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Perl::Critic::Policy::Dancer2::ProhibitUnrecommendedKeywords - Trigger perlcritic alerts on unrecommended Dancer2 keywords |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
version 0.4000 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
The L<Dancer2> team has a deprecation policy, detailed at |
57
|
|
|
|
|
|
|
L<Dancer2::DeprecationPolicy>, that will, in time, cause certain |
58
|
|
|
|
|
|
|
keywords to be removed from the Dancer2 codebase. The keywords |
59
|
|
|
|
|
|
|
addressed in this policy have newer substitutes and/or have been |
60
|
|
|
|
|
|
|
suggested for deprecation. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AFFILIATION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This policy is part of L<Perl::Critic::Dancer2>. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 CONFIGURATION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This Policy is not configurable except for the standard options. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
D Ruth Holloway <ruth@hiruthie.me> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This software is copyright (c) 2022 by D Ruth Holloway. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
79
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |