line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Critic::Policy::ValuesAndExpressions::ProhibitImplicitNewlines; |
2
|
|
|
|
|
|
|
|
3
|
40
|
|
|
40
|
|
26424
|
use 5.010001; |
|
40
|
|
|
|
|
184
|
|
4
|
40
|
|
|
40
|
|
245
|
use strict; |
|
40
|
|
|
|
|
95
|
|
|
40
|
|
|
|
|
825
|
|
5
|
40
|
|
|
40
|
|
231
|
use warnings; |
|
40
|
|
|
|
|
89
|
|
|
40
|
|
|
|
|
952
|
|
6
|
40
|
|
|
40
|
|
305
|
use Readonly; |
|
40
|
|
|
|
|
102
|
|
|
40
|
|
|
|
|
2079
|
|
7
|
|
|
|
|
|
|
|
8
|
40
|
|
|
40
|
|
289
|
use Perl::Critic::Utils qw{ :severities :classification }; |
|
40
|
|
|
|
|
94
|
|
|
40
|
|
|
|
|
2104
|
|
9
|
40
|
|
|
40
|
|
14862
|
use parent 'Perl::Critic::Policy'; |
|
40
|
|
|
|
|
133
|
|
|
40
|
|
|
|
|
299
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.148'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Literal line breaks in a string}; |
16
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => [60,61]; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
19
|
|
|
|
|
|
|
|
20
|
92
|
|
|
92
|
0
|
1639
|
sub supported_parameters { return () } |
21
|
78
|
|
|
78
|
1
|
411
|
sub default_severity { return $SEVERITY_MEDIUM } |
22
|
84
|
|
|
84
|
1
|
388
|
sub default_themes { return qw( core pbp cosmetic ) } |
23
|
33
|
|
|
33
|
1
|
113
|
sub applies_to { return 'PPI::Token::Quote' } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub violates { |
28
|
84
|
|
|
84
|
1
|
246
|
my ( $self, $elem, undef ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
84
|
100
|
|
|
|
311
|
return if $elem->string !~ m/\n/xms; |
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
78
|
return $self->violation( $DESC, $EXPL, $elem ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Perl::Critic::Policy::ValuesAndExpressions::ProhibitImplicitNewlines - Use concatenation or HEREDOCs instead of literal line breaks in strings. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 AFFILIATION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This Policy is part of the core L<Perl::Critic|Perl::Critic> |
50
|
|
|
|
|
|
|
distribution. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Strings with embedded line breaks are hard to read. Use concatenation |
56
|
|
|
|
|
|
|
or HEREDOCs instead. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $foo = "Line one is quite long |
59
|
|
|
|
|
|
|
Line two"; # Bad |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $foo = "Line one is quite long\nLine two"; # Better, but still hard to read |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $foo = "Line one is quite long\n" |
64
|
|
|
|
|
|
|
. "Line two"; # Better still |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $foo = <<'EOF'; # Use heredoc for longer passages |
67
|
|
|
|
|
|
|
Line one is quite long |
68
|
|
|
|
|
|
|
Line two |
69
|
|
|
|
|
|
|
Line three breaks the camel's back |
70
|
|
|
|
|
|
|
EOF |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 CONFIGURATION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This Policy is not configurable except for the standard options. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Chris Dolan <cdolan@cpan.org> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 CREDITS |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Initial development of this policy was supported by a grant from the |
86
|
|
|
|
|
|
|
Perl Foundation. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Copyright (c) 2007-2011 Chris Dolan. Many rights reserved. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
95
|
|
|
|
|
|
|
it under the same terms as Perl itself. The full text of this license |
96
|
|
|
|
|
|
|
can be found in the LICENSE file included with this module. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# Local Variables: |
101
|
|
|
|
|
|
|
# mode: cperl |
102
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
103
|
|
|
|
|
|
|
# fill-column: 78 |
104
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
105
|
|
|
|
|
|
|
# c-indentation-style: bsd |
106
|
|
|
|
|
|
|
# End: |
107
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |