line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Critic::Policy::OTRS::RequireParensWithMethods; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Use parens when a method is called |
4
|
|
|
|
|
|
|
|
5
|
24
|
|
|
24
|
|
14428
|
use strict; |
|
24
|
|
|
|
|
58
|
|
|
24
|
|
|
|
|
675
|
|
6
|
24
|
|
|
24
|
|
115
|
use warnings; |
|
24
|
|
|
|
|
52
|
|
|
24
|
|
|
|
|
677
|
|
7
|
|
|
|
|
|
|
|
8
|
24
|
|
|
24
|
|
121
|
use Perl::Critic::Utils qw{ :severities :classification :ppi }; |
|
24
|
|
|
|
|
46
|
|
|
24
|
|
|
|
|
1128
|
|
9
|
24
|
|
|
24
|
|
8346
|
use base 'Perl::Critic::Policy'; |
|
24
|
|
|
|
|
53
|
|
|
24
|
|
|
|
|
2207
|
|
10
|
|
|
|
|
|
|
|
11
|
24
|
|
|
24
|
|
152
|
use Readonly; |
|
24
|
|
|
|
|
52
|
|
|
24
|
|
|
|
|
5843
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Method invocation should use "()"}; |
16
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => q{Use "->MethodName()" instead of "->MethodName".}; |
17
|
|
|
|
|
|
|
|
18
|
12
|
|
|
12
|
1
|
28474
|
sub supported_parameters { return; } |
19
|
3
|
|
|
3
|
1
|
34
|
sub default_severity { return $SEVERITY_HIGHEST; } |
20
|
1
|
|
|
1
|
1
|
718
|
sub default_themes { return qw( otrs otrs_lt_3_3 ) } |
21
|
3
|
|
|
3
|
1
|
193979
|
sub applies_to { return 'PPI::Token::Operator' } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub violates { |
24
|
8
|
|
|
8
|
1
|
430
|
my ( $self, $elem ) = @_; |
25
|
|
|
|
|
|
|
|
26
|
8
|
100
|
|
|
|
20
|
return if $elem ne '->'; |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
60
|
my $method = $elem->snext_sibling; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# $Variable->(); |
31
|
4
|
50
|
|
|
|
94
|
return if ref $method eq 'PPI::Structure::List'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# $Variable->method(); |
34
|
4
|
50
|
|
|
|
12
|
return if ref $method eq 'PPI::Structure::Subscript'; |
35
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
14
|
my $list = $method->snext_sibling; |
37
|
4
|
100
|
|
|
|
122
|
return if ref $list eq 'PPI::Structure::List'; |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
12
|
return $self->violation( $DESC, $EXPL, $elem ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=encoding UTF-8 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Perl::Critic::Policy::OTRS::RequireParensWithMethods - Use parens when a method is called |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
version 0.09 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 supported_parameters |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
There are no supported parameters. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Renee Baecker <info@perl-services.de> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Renee Baecker. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This is free software, licensed under: |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |