Bugzilla – Attachment 79537 Details for
Bug 21393
Make template filter checks code reusable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21393: Add line nubmers to ease fixing
Bug-21393-Add-line-nubmers-to-ease-fixing.patch (text/plain), 5.72 KB, created by
Katrin Fischer
on 2018-09-27 15:55:55 UTC
(
hide
)
Description:
Bug 21393: Add line nubmers to ease fixing
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-09-27 15:55:55 UTC
Size:
5.72 KB
patch
obsolete
>From b79806cc00265cc2627aa83b9d6b756ee4e34355 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 21 Sep 2018 12:33:19 -0300 >Subject: [PATCH] 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> >--- > t/lib/QA/TemplateFilters.pm | 6 ++-- > t/template_filters.t | 70 ++++++++++++++++++++++++++++----------------- > 2 files changed, 48 insertions(+), 28 deletions(-) > >diff --git a/t/lib/QA/TemplateFilters.pm b/t/lib/QA/TemplateFilters.pm >index 0185565..4b4a3d2 100644 >--- a/t/lib/QA/TemplateFilters.pm >+++ b/t/lib/QA/TemplateFilters.pm >@@ -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 >diff --git a/t/template_filters.t b/t/template_filters.t >index 4131534..a36e756 100644 >--- a/t/template_filters.t >+++ b/t/template_filters.t >@@ -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, > } > ); > >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21393
:
79236
|
79237
|
79238
|
79281
|
79282
|
79283
|
79535
|
79536
| 79537