line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::TrailingSpace; |
2
|
|
|
|
|
|
|
$Test::TrailingSpace::VERSION = '0.0601'; |
3
|
2
|
|
|
2
|
|
175486
|
use 5.014; |
|
2
|
|
|
|
|
27
|
|
4
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
48
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
6
|
2
|
|
|
2
|
|
741
|
use autodie; |
|
2
|
|
|
|
|
18268
|
|
|
2
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
13440
|
use Test::More; |
|
2
|
|
|
|
|
6524
|
|
|
2
|
|
|
|
|
26
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
2065
|
use File::Find::Object::Rule 0.0301; |
|
2
|
|
|
|
|
48354
|
|
|
2
|
|
|
|
|
18
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
11
|
|
|
11
|
1
|
64613
|
my $class = shift; |
15
|
|
|
|
|
|
|
|
16
|
11
|
|
|
|
|
36
|
my $self = bless {}, $class; |
17
|
|
|
|
|
|
|
|
18
|
11
|
|
|
|
|
49
|
$self->_init(@_); |
19
|
|
|
|
|
|
|
|
20
|
11
|
|
|
|
|
36
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _filename_regex |
24
|
|
|
|
|
|
|
{ |
25
|
22
|
|
|
22
|
|
1683
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
22
|
100
|
|
|
|
62
|
if (@_) |
28
|
|
|
|
|
|
|
{ |
29
|
11
|
|
|
|
|
25
|
$self->{_filename_regex} = shift; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
22
|
|
|
|
|
56
|
return $self->{_filename_regex}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _root_path |
36
|
|
|
|
|
|
|
{ |
37
|
22
|
|
|
22
|
|
1318
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
22
|
100
|
|
|
|
60
|
if (@_) |
40
|
|
|
|
|
|
|
{ |
41
|
11
|
|
|
|
|
42
|
$self->{_root_path} = shift; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
22
|
|
|
|
|
61
|
return $self->{_root_path}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _abs_path_prune_re |
48
|
|
|
|
|
|
|
{ |
49
|
22
|
|
|
22
|
|
49
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
22
|
100
|
|
|
|
53
|
if (@_) |
52
|
|
|
|
|
|
|
{ |
53
|
11
|
|
|
|
|
47
|
$self->{_abs_path_prune_re} = shift; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
22
|
|
|
|
|
47
|
return $self->{_abs_path_prune_re}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _path_cb |
60
|
|
|
|
|
|
|
{ |
61
|
22
|
|
|
22
|
|
57
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
22
|
100
|
|
|
|
80
|
if (@_) |
64
|
|
|
|
|
|
|
{ |
65
|
11
|
|
|
|
|
36
|
$self->{_path_cb} = shift; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
22
|
|
|
|
|
302
|
return $self->{_path_cb}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _init |
72
|
|
|
|
|
|
|
{ |
73
|
11
|
|
|
11
|
|
31
|
my ( $self, $args ) = @_; |
74
|
|
|
|
|
|
|
|
75
|
11
|
50
|
|
|
|
69
|
$self->_root_path( exists( $args->{root} ) ? $args->{root} : '.' ); |
76
|
11
|
|
|
|
|
40
|
$self->_filename_regex( $args->{filename_regex} ); |
77
|
11
|
|
|
|
|
42
|
$self->_abs_path_prune_re( $args->{abs_path_prune_re} ); |
78
|
11
|
|
|
|
|
27
|
my $find_cr = $args->{find_cr}; |
79
|
|
|
|
|
|
|
|
80
|
11
|
100
|
|
|
|
29
|
my $OPEN_MODE = $find_cr ? '<:raw' : '<'; |
81
|
11
|
|
|
|
|
34
|
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
|
|
|
|
|
25
|
$cb .= |
84
|
|
|
|
|
|
|
q#if ( $l =~ /[ \\t]+\\r?\\z/ ){diag("Found trailing space in file '$p'");++$nf; last L;}#; |
85
|
11
|
100
|
|
|
|
31
|
if ( $args->{find_tabs} ) |
86
|
|
|
|
|
|
|
{ |
87
|
3
|
|
|
|
|
8
|
$cb .= |
88
|
|
|
|
|
|
|
q#if ( $l =~ /\\t/ ) { diag("Found hard tabs in file '$p'"); ++$nf; last L;}#; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
11
|
100
|
|
|
|
28
|
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
|
|
|
|
|
24
|
$cb .= "} } return \$nf;}"; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
## no critic |
99
|
11
|
|
|
|
|
3065
|
$self->_path_cb( eval($cb) ); |
100
|
|
|
|
|
|
|
## use critic |
101
|
11
|
|
|
|
|
51
|
return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub no_trailing_space |
105
|
|
|
|
|
|
|
{ |
106
|
11
|
|
|
11
|
1
|
15997
|
local $Test::Builder::Level = $Test::Builder::Level + 1; |
107
|
|
|
|
|
|
|
|
108
|
11
|
|
|
|
|
32
|
my ( $self, $blurb ) = @_; |
109
|
|
|
|
|
|
|
|
110
|
11
|
|
|
|
|
101
|
my $subrule = File::Find::Object::Rule->new; |
111
|
|
|
|
|
|
|
|
112
|
11
|
|
|
|
|
154
|
my $abs_path_prune_re = $self->_abs_path_prune_re(); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my $rule = $subrule->or( |
115
|
|
|
|
|
|
|
$subrule->new->exec( |
116
|
|
|
|
|
|
|
sub { |
117
|
116
|
|
|
116
|
|
53647
|
my ( $shortname, undef, $path ) = @_; |
118
|
|
|
|
|
|
|
return ( |
119
|
|
|
|
|
|
|
( |
120
|
116
|
|
66
|
|
|
2886
|
$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
|
|
|
|
|
37
|
)->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
|
|
|
|
|
6934
|
my $num_found = $self->_path_cb()->($rule); |
134
|
|
|
|
|
|
|
|
135
|
11
|
|
|
|
|
58
|
return is( $num_found, 0, $blurb ); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
__END__ |