Bug 31684

Summary: Plugin versions starting with a "v" cause unnecessary warnings
Product: Koha Reporter: Kyle M Hall <kyle>
Component: Plugin architectureAssignee: Kyle M Hall <kyle>
Status: RESOLVED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: trivial    
Priority: P5 - low CC: arthur.suzuki, lucas, m.de.rooy, tomascohen, wainuiwitikapark
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:
22.11.00, 22.05.08, 21.11.15
Bug Depends on:    
Bug Blocks: 31909    
Attachments: Bug 31684: Set Koha::Plugin::Test version to 'v1.01'
Bug 31684: Plugin versions starting with a "v" cause unnecessary warnings
Bug 31684: Set Koha::Plugin::Test version to 'v1.01'
Bug 31684: Plugin versions starting with a "v" cause unnecessary warnings
Bug 31684: Set Koha::Plugin::Test version to 'v1.01'
Bug 31684: Plugin versions starting with a "v" cause unnecessary warnings

Description Kyle M Hall 2022-10-05 11:04:10 UTC
Our code assumes that plugin version will be purely numeric ( e.g. 1.2.3 ) but many plugin authors ( including myself ) use the format "v1.2.3". This causes warnings as we use a numeric comparison on the version numbers. It could make sense to check for and strip any v's from the beginning of the version.
Comment 1 Kyle M Hall 2022-10-05 12:49:10 UTC
Created attachment 141379 [details] [review]
Bug 31684: Set Koha::Plugin::Test version to 'v1.01'
Comment 2 Kyle M Hall 2022-10-05 12:49:23 UTC
Created attachment 141380 [details] [review]
Bug 31684: Plugin versions starting with a "v" cause unnecessary warnings

Our code assumes that plugin version will be purely numeric ( e.g. 1.2.3 ) but many plugin authors ( including myself ) use the format "v1.2.3".
This causes warnings as we use a numeric comparison on the version numbers.
It could make sense to check for and strip any v's from the beginning of the version.

Test Plan:
1) Apply the first patch to set the test plugin's version to v1.01
2) prove t/db_dependent/Koha/Plugins/Plugins.t
3) Note the warnings and test failures
4) Apply this patch
5) prove t/db_dependent/Koha/Plugins/Plugins.t
6) All tests pass!
Comment 3 David Nind 2022-10-10 20:47:05 UTC
Created attachment 141589 [details] [review]
Bug 31684: Set Koha::Plugin::Test version to 'v1.01'

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2022-10-10 20:47:11 UTC
Created attachment 141590 [details] [review]
Bug 31684: Plugin versions starting with a "v" cause unnecessary warnings

Our code assumes that plugin version will be purely numeric ( e.g. 1.2.3 ) but many plugin authors ( including myself ) use the format "v1.2.3".
This causes warnings as we use a numeric comparison on the version numbers.
It could make sense to check for and strip any v's from the beginning of the version.

Test Plan:
1) Apply the first patch to set the test plugin's version to v1.01
2) prove t/db_dependent/Koha/Plugins/Plugins.t
3) Note the warnings and test failures
4) Apply this patch
5) prove t/db_dependent/Koha/Plugins/Plugins.t
6) All tests pass!

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Katrin Fischer 2022-10-17 10:37:45 UTC
Please don't forget to set Assignee!
Comment 6 Kyle M Hall 2022-10-17 10:47:04 UTC
(In reply to Katrin Fischer from comment #5)
> Please don't forget to set Assignee!

Ack! Thanks again!
Comment 7 Marcel de Rooy 2022-10-21 06:48:39 UTC
Created attachment 142292 [details] [review]
Bug 31684: Set Koha::Plugin::Test version to 'v1.01'

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Marcel de Rooy 2022-10-21 06:48:43 UTC
Created attachment 142293 [details] [review]
Bug 31684: Plugin versions starting with a "v" cause unnecessary warnings

Our code assumes that plugin version will be purely numeric ( e.g. 1.2.3 ) but many plugin authors ( including myself ) use the format "v1.2.3".
This causes warnings as we use a numeric comparison on the version numbers.
It could make sense to check for and strip any v's from the beginning of the version.

Test Plan:
1) Apply the first patch to set the test plugin's version to v1.01
2) prove t/db_dependent/Koha/Plugins/Plugins.t
3) Note the warnings and test failures
4) Apply this patch
5) prove t/db_dependent/Koha/Plugins/Plugins.t
6) All tests pass!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Tomás Cohen Arazi 2022-10-21 11:52:09 UTC
Why don't we force some coding line to align plugin authors about verisoning instead? Plugins could just be forced to use semvers?
Comment 10 Tomás Cohen Arazi 2022-10-21 13:02:06 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 11 Lucas Gass 2022-12-05 21:12:32 UTC
Backported to 22.05.x for upcoming 22.05.08
Comment 12 Arthur Suzuki 2022-12-16 13:34:08 UTC
applied to 21.11 for 21.11.15
Comment 13 wainuiwitikapark 2023-03-15 00:58:05 UTC
Not backported to 21.05.x