line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Critic::Policy::CodeLayout::ProhibitSpaceIndentation; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
450649
|
use strict; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
96
|
|
4
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
80
|
|
5
|
3
|
|
|
3
|
|
1209
|
use Readonly; |
|
3
|
|
|
|
|
8079
|
|
|
3
|
|
|
|
|
234
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.02'; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
1435
|
use Perl::Critic::Utils qw{ :booleans :severities }; |
|
3
|
|
|
|
|
260915
|
|
|
3
|
|
|
|
|
147
|
|
10
|
3
|
|
|
3
|
|
1801
|
use base qw(Perl::Critic::Policy); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
1990
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Spaces used for indentation}; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Readonly::Scalar my $SPACE_INDENT_REGEX => qr/^(\n*)\t* +\t*/; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub default_severity { |
19
|
8
|
|
|
8
|
1
|
87
|
return $SEVERITY_LOW; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub default_themes { |
23
|
0
|
|
|
0
|
1
|
0
|
return qw(cosmetic); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub applies_to { |
27
|
3
|
|
|
3
|
1
|
48738
|
return 'PPI::Token'; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub violates { |
31
|
57
|
|
|
57
|
1
|
1718
|
my ($self, $elem, undef) = @_; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
57
|
100
|
100
|
|
|
153
|
if ($elem->location->[1] == 1 && $elem =~ $SPACE_INDENT_REGEX) { |
35
|
8
|
|
|
|
|
195
|
return $self->violation($DESC, undef, $elem); |
36
|
|
|
|
|
|
|
} else { |
37
|
49
|
|
|
|
|
734
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Perl::Critic::Policy::CodeLayout::ProhibitSpaceIndentation - Use tabs instead of spaces for indentation. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
For projects which have a policy of using tabs for indentation, you want to |
52
|
|
|
|
|
|
|
ensure there are no spaces used for that purpose. This Policy catches all |
53
|
|
|
|
|
|
|
such occurrences so that you can be sure when the tab sizes are reconfigured, |
54
|
|
|
|
|
|
|
spaces won't make indented code look wrong. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This policy can be used together with |
57
|
|
|
|
|
|
|
L<CodeLayout::ProhibitHardTabs|Perl::Critic::Policy::CodeLayout::ProhibitHardTabs> |
58
|
|
|
|
|
|
|
by setting C<allow_leading_tabs> option of the latter to C<1>. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 CONFIGURATION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This Policy is not configurable except for the standard options. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NOTES |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
If there are blank lines before a violating line, the first blank line will be |
69
|
|
|
|
|
|
|
reported as the violation location, because all the whitespace forms a single |
70
|
|
|
|
|
|
|
token which Perl::Critic gives to the policy. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Infoxchange Australia <devs@infoxchange.net.au> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Copyright (c) 2012 Infoxchange Australia. All rights reserved. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
83
|
|
|
|
|
|
|
it under the same terms as Perl itself. The full text of this license |
84
|
|
|
|
|
|
|
can be found in the LICENSE file included with this module. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|