line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::TrailingSpace; |
2
|
|
|
|
|
|
|
$Test::TrailingSpace::VERSION = '0.0600'; |
3
|
2
|
|
|
2
|
|
141775
|
use 5.014; |
|
2
|
|
|
|
|
23
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
37
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
44
|
|
6
|
2
|
|
|
2
|
|
1022
|
use autodie; |
|
2
|
|
|
|
|
32685
|
|
|
2
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
14877
|
use Test::More; |
|
2
|
|
|
|
|
6222
|
|
|
2
|
|
|
|
|
22
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
1946
|
use File::Find::Object::Rule 0.0301; |
|
2
|
|
|
|
|
43639
|
|
|
2
|
|
|
|
|
16
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
11
|
|
|
11
|
1
|
36723
|
my $class = shift; |
15
|
|
|
|
|
|
|
|
16
|
11
|
|
|
|
|
31
|
my $self = bless {}, $class; |
17
|
|
|
|
|
|
|
|
18
|
11
|
|
|
|
|
44
|
$self->_init(@_); |
19
|
|
|
|
|
|
|
|
20
|
11
|
|
|
|
|
32
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _filename_regex |
24
|
|
|
|
|
|
|
{ |
25
|
22
|
|
|
22
|
|
1580
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
22
|
100
|
|
|
|
65
|
if (@_) |
28
|
|
|
|
|
|
|
{ |
29
|
11
|
|
|
|
|
22
|
$self->{_filename_regex} = shift; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
22
|
|
|
|
|
54
|
return $self->{_filename_regex}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _root_path |
36
|
|
|
|
|
|
|
{ |
37
|
22
|
|
|
22
|
|
1338
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
22
|
100
|
|
|
|
57
|
if (@_) |
40
|
|
|
|
|
|
|
{ |
41
|
11
|
|
|
|
|
38
|
$self->{_root_path} = shift; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
22
|
|
|
|
|
62
|
return $self->{_root_path}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _abs_path_prune_re |
48
|
|
|
|
|
|
|
{ |
49
|
22
|
|
|
22
|
|
39
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
22
|
100
|
|
|
|
53
|
if (@_) |
52
|
|
|
|
|
|
|
{ |
53
|
11
|
|
|
|
|
58
|
$self->{_abs_path_prune_re} = shift; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
22
|
|
|
|
|
38
|
return $self->{_abs_path_prune_re}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _path_cb |
60
|
|
|
|
|
|
|
{ |
61
|
22
|
|
|
22
|
|
56
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
22
|
100
|
|
|
|
67
|
if (@_) |
64
|
|
|
|
|
|
|
{ |
65
|
11
|
|
|
|
|
25
|
$self->{_path_cb} = shift; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
22
|
|
|
|
|
297
|
return $self->{_path_cb}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _init |
72
|
|
|
|
|
|
|
{ |
73
|
11
|
|
|
11
|
|
27
|
my ( $self, $args ) = @_; |
74
|
|
|
|
|
|
|
|
75
|
11
|
50
|
|
|
|
58
|
$self->_root_path( exists( $args->{root} ) ? $args->{root} : '.' ); |
76
|
11
|
|
|
|
|
34
|
$self->_filename_regex( $args->{filename_regex} ); |
77
|
11
|
|
|
|
|
36
|
$self->_abs_path_prune_re( $args->{abs_path_prune_re} ); |
78
|
11
|
|
|
|
|
21
|
my $find_cr = $args->{find_cr}; |
79
|
|
|
|
|
|
|
|
80
|
11
|
100
|
|
|
|
75
|
my $OPEN_MODE = $find_cr ? '<:raw' : '<'; |
81
|
11
|
|
|
|
|
29
|
my $cb = |
82
|
|
|
|
|
|
|
"sub { my (\$r) = \@_; my \$nf = 0; while (my \$p = \$r->match()) { open( my \$fh, '$OPEN_MODE', \$p ); L: while ( my \$l = <\$fh> ){chomp(\$l);"; |
83
|
11
|
|
|
|
|
22
|
$cb .= |
84
|
|
|
|
|
|
|
q#if ( $l =~ /[ \\t]+\\r?\\z/ ){diag("Found trailing space in file '$p'");++$nf; last L;}#; |
85
|
11
|
100
|
|
|
|
27
|
if ( $args->{find_tabs} ) |
86
|
|
|
|
|
|
|
{ |
87
|
3
|
|
|
|
|
7
|
$cb .= |
88
|
|
|
|
|
|
|
q#if ( $l =~ /\\t/ ) { diag("Found hard tabs in file '$p'"); ++$nf; last L;}#; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
11
|
100
|
|
|
|
23
|
if ($find_cr) |
92
|
|
|
|
|
|
|
{ |
93
|
2
|
|
|
|
|
6
|
$cb .= |
94
|
|
|
|
|
|
|
q# if ( $l =~ /\\r\\z/ ) { diag("Found Carriage Returns line endings in file '$p'"); ++$nf; last L; }#; |
95
|
|
|
|
|
|
|
} |
96
|
11
|
|
|
|
|
20
|
$cb .= "} } return \$nf;}"; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
## no critic |
99
|
11
|
|
|
|
|
3166
|
$self->_path_cb( eval($cb) ); |
100
|
|
|
|
|
|
|
## use critic |
101
|
11
|
|
|
|
|
43
|
return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub no_trailing_space |
105
|
|
|
|
|
|
|
{ |
106
|
11
|
|
|
11
|
1
|
14893
|
local $Test::Builder::Level = $Test::Builder::Level + 1; |
107
|
|
|
|
|
|
|
|
108
|
11
|
|
|
|
|
27
|
my ( $self, $blurb ) = @_; |
109
|
|
|
|
|
|
|
|
110
|
11
|
|
|
|
|
83
|
my $subrule = File::Find::Object::Rule->new; |
111
|
|
|
|
|
|
|
|
112
|
11
|
|
|
|
|
139
|
my $abs_path_prune_re = $self->_abs_path_prune_re(); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my $rule = $subrule->or( |
115
|
|
|
|
|
|
|
$subrule->new->exec( |
116
|
|
|
|
|
|
|
sub { |
117
|
121
|
|
|
121
|
|
52296
|
my ( $shortname, undef, $path ) = @_; |
118
|
|
|
|
|
|
|
return ( |
119
|
|
|
|
|
|
|
( |
120
|
121
|
|
66
|
|
|
2947
|
$shortname =~ |
121
|
|
|
|
|
|
|
/\A(?:blib|_build|CVS|\.svn|\.bzr|\.hg|\.git)\z/ |
122
|
|
|
|
|
|
|
) |
123
|
|
|
|
|
|
|
or ( defined($abs_path_prune_re) |
124
|
|
|
|
|
|
|
&& ( $path =~ m/$abs_path_prune_re/ ) ) |
125
|
|
|
|
|
|
|
); |
126
|
|
|
|
|
|
|
} |
127
|
11
|
|
|
|
|
36
|
)->prune->discard, |
128
|
|
|
|
|
|
|
$subrule->new->file() |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# ->exec(sub { print STDERR join(",", "Foo==", @_), "\n"; return 1; }) |
131
|
|
|
|
|
|
|
->name( $self->_filename_regex() ), |
132
|
|
|
|
|
|
|
)->start( $self->_root_path() ); |
133
|
11
|
|
|
|
|
6441
|
my $num_found = $self->_path_cb()->($rule); |
134
|
|
|
|
|
|
|
|
135
|
11
|
|
|
|
|
50
|
return is( $num_found, 0, $blurb ); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
__END__ |