Bug 18753

Summary: t/00-testcritic.t fails Perl::Critic on test 221
Product: Koha Reporter: Lee Jamison <ldjamison>
Component: Test SuiteAssignee: Lee Jamison <ldjamison>
Status: RESOLVED DUPLICATE QA Contact: Galen Charlton <gmcharlt>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, mtompset
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 18753 - t/00-testcritic fails Perl::Critic
Bug 18753: t/00-testcritic.t fails
Bug 18753 - t/00-testcritic fails Perl::Critic

Description Lee Jamison 2017-06-07 19:16:06 UTC
Unit Test t/00-testcritic.t fails to pass Perl::Critic on Test 221.
Comment 1 Lee Jamison 2017-06-07 20:32:00 UTC
Created attachment 64090 [details] [review]
Bug 18753 - t/00-testcritic fails Perl::Critic

Bug Description:
When performing a unit test on t/00-testcritic.t with the command
'prove t/00-testcritic.t' test 221 fails Perl::Critic with

not ok 221 - Test::Perl::Critic for "reserve/request.pl"
   Failed test 'Test::Perl::Critic for "reserve/request.pl"'
   at /usr/share/perl5/Test/Perl/Critic.pm line 110.

Perl::Critic found these violations in "reserve/request.pl":
"$itemnumbers_of_biblioitem" is declared but not used at
line 314, column 5. Unused variables clutter code and make it
harder to read  (Severity: 3)

Cause of bug:
The variable $itemnumbers_of_biblioitem is declared but never used
in reserve/request.pl which causes the Perl::Critic violation.

Patch Description:
This patch removes the variable $itemnumbers_of_biblioitem from
reserve/request.pl in order to satisfy Perl::Critic. The variable
$itemnumbers_of_biblioitem is never used anywhere in
reserve/request.pl other than its declaration so it should not
cause any undesired effects.

Test Plan:
1) Drop into koha-shell and run the command 'prove t/00-testcritic.t'.
2) Test 221 fails.
3) Apply the patch.
4) Re-run 'prove t/00-testcritic.t'.
5) All of the tests pass now.
6) Quit out of koha-shell.
Comment 2 Mark Tompsett 2017-06-07 23:34:17 UTC
I think this is the wrong solution. The problem is that variable is used as a hash elsewhere. I think the problem is % vs $ not the variable name. Providing counter-patch.
Comment 3 Mark Tompsett 2017-06-07 23:38:25 UTC
Created attachment 64092 [details] [review]
Bug 18753: t/00-testcritic.t fails

TEST PLAN
---------
$ export TEST_QA=1
$ sudo apt-get install libtest-perl-critic-perl
$ prove t/00-testcritic.t
-- test 221 will fail
apply patch
$ prove t/00-testcritic.t
-- all tests will pass

NOTE: Obsoleted Lee's patch.
Comment 4 Mark Tompsett 2017-06-07 23:41:15 UTC
Comment on attachment 64090 [details] [review]
Bug 18753 - t/00-testcritic fails Perl::Critic

There actually is a hash declaration version earlier! DOH! This is correct.
Comment 5 Mark Tompsett 2017-06-07 23:44:23 UTC
Created attachment 64093 [details] [review]
Bug 18753 - t/00-testcritic fails Perl::Critic

Bug Description:
When performing a unit test on t/00-testcritic.t with the command
'prove t/00-testcritic.t' test 221 fails Perl::Critic with

not ok 221 - Test::Perl::Critic for "reserve/request.pl"
   Failed test 'Test::Perl::Critic for "reserve/request.pl"'
   at /usr/share/perl5/Test/Perl/Critic.pm line 110.

Perl::Critic found these violations in "reserve/request.pl":
"$itemnumbers_of_biblioitem" is declared but not used at
line 314, column 5. Unused variables clutter code and make it
harder to read  (Severity: 3)

Cause of bug:
The variable $itemnumbers_of_biblioitem is declared but never used
in reserve/request.pl which causes the Perl::Critic violation.

Patch Description:
This patch removes the variable $itemnumbers_of_biblioitem from
reserve/request.pl in order to satisfy Perl::Critic. The variable
$itemnumbers_of_biblioitem is never used anywhere in
reserve/request.pl other than its declaration so it should not
cause any undesired effects.

Test Plan:
1) Drop into koha-shell and run the command 'prove t/00-testcritic.t'.
2) Test 221 fails.
3) Apply the patch.
4) Re-run 'prove t/00-testcritic.t'.
5) All of the tests pass now.
6) Quit out of koha-shell.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 6 Jonathan Druart 2017-06-08 15:12:20 UTC
Sorry, missed that one.

I have fixed it with
  commit b5b046599b6604c6cfd681d8392c560b3df738d2
  Bug 18296: Remove perlcritic error (request.pl)

*** This bug has been marked as a duplicate of bug 18296 ***