Bug 21393: Add line nubmers to ease fixing
Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
3ad96419a7
commit
7d56a5fe00
2 changed files with 48 additions and 28 deletions
|
@ -30,7 +30,9 @@ sub missing_filters {
|
|||
my ($content) = @_;
|
||||
my ( $use_raw, $has_use_raw );
|
||||
my @errors;
|
||||
my $line_number;
|
||||
for my $line ( split "\n", $content ) {
|
||||
$line_number++;
|
||||
if ( $line =~ m{\[%[^%]+%\]} ) {
|
||||
|
||||
# handle exceptions first
|
||||
|
@ -39,7 +41,7 @@ sub missing_filters {
|
|||
|
||||
# Do we have Asset without the raw filter?
|
||||
if ( $line =~ m{^\s*\[% Asset} ) {
|
||||
push @errors, { error => 'asset_must_be_raw', line => $line }
|
||||
push @errors, { error => 'asset_must_be_raw', line => $line, line_number => $line_number }
|
||||
and next
|
||||
unless $line =~ m{\|\s*\$raw};
|
||||
}
|
||||
|
@ -67,7 +69,7 @@ sub missing_filters {
|
|||
; # We could escape it but should be safe
|
||||
next if $tt_block =~ m{^\#}; # Is a comment, skip it
|
||||
|
||||
push @errors, { error => 'missing_filter', line => $line }
|
||||
push @errors, { error => 'missing_filter', line => $line, line_number => $line_number }
|
||||
if $tt_block !~ m{\|\s?\$raw} # already escaped correctly with raw
|
||||
&& $tt_block !~ m{=} # assignment, maybe we should require to use SET (?)
|
||||
&& $tt_block !~ m{\|\s?ur(l|i)} # already has url or uri filter
|
||||
|
|
|
@ -61,56 +61,74 @@ INPUT
|
|||
|
||||
my @expected_errors = (
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{ [% just_a_var %] A N D [% another_one_on_same_line %]},
|
||||
error => q{missing_filter},
|
||||
line =>
|
||||
q{ [% just_a_var %] A N D [% another_one_on_same_line %]},
|
||||
line_number => 6,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{ [% just_a_var %] A N D [% another_one_on_same_line %]},
|
||||
error => q{missing_filter},
|
||||
line =>
|
||||
q{ [% just_a_var %] A N D [% another_one_on_same_line %]},
|
||||
line_number => 6,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{ [% IF ( patron.othernames | html ) %]“[% patron.othernames %]”[% END %]},
|
||||
error => q{missing_filter},
|
||||
line =>
|
||||
q{ [% IF ( patron.othernames | html ) %]“[% patron.othernames %]”[% END %]},
|
||||
line_number => 12,
|
||||
},
|
||||
{
|
||||
error => q{asset_must_be_raw},
|
||||
line => q{ [% Asset.css("css/datatables.css").raw %]},
|
||||
error => q{asset_must_be_raw},
|
||||
line => q{ [% Asset.css("css/datatables.css").raw %]},
|
||||
line_number => 13,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{<a href="tel:[% patron.phone %]">[% patron.phone %]</a>},
|
||||
error => q{missing_filter},
|
||||
line => q{<a href="tel:[% patron.phone %]">[% patron.phone %]</a>},
|
||||
line_number => 16,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{<a href="tel:[% patron.phone %]">[% patron.phone %]</a>},
|
||||
error => q{missing_filter},
|
||||
line => q{<a href="tel:[% patron.phone %]">[% patron.phone %]</a>},
|
||||
line_number => 16,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{<a title="[% patron.emailpro %]" href="mailto:[% patron.emailpro | uri %]">[% patron.emailpro %]</a>},
|
||||
error => q{missing_filter},
|
||||
line =>
|
||||
q{<a title="[% patron.emailpro %]" href="mailto:[% patron.emailpro | uri %]">[% patron.emailpro %]</a>},
|
||||
line_number => 17,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{<a title="[% patron.emailpro %]" href="mailto:[% patron.emailpro | uri %]">[% patron.emailpro %]</a>},
|
||||
error => q{missing_filter},
|
||||
line =>
|
||||
q{<a title="[% patron.emailpro %]" href="mailto:[% patron.emailpro | uri %]">[% patron.emailpro %]</a>},
|
||||
line_number => 17,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{[% patron_message.get_column('manager_surname') %]},
|
||||
error => q{missing_filter},
|
||||
line => q{[% patron_message.get_column('manager_surname') %]},
|
||||
line_number => 18,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{[%- var -%]},
|
||||
error => q{missing_filter},
|
||||
line => q{[%- var -%]},
|
||||
line_number => 29,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{[% - var - %]},
|
||||
error => q{missing_filter},
|
||||
line => q{[% - var - %]},
|
||||
line_number => 30,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{[%~ var ~%]},
|
||||
error => q{missing_filter},
|
||||
line => q{[%~ var ~%]},
|
||||
line_number => 31,
|
||||
},
|
||||
{
|
||||
error => q{missing_filter},
|
||||
line => q{[% ~ var ~ %]},
|
||||
error => q{missing_filter},
|
||||
line => q{[% ~ var ~ %]},
|
||||
line_number => 32,
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue