Bug 40541 - Add new line at the end of the files when missing
Summary: Add new line at the end of the files when missing
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-29 09:50 UTC by Jonathan Druart
Modified: 2025-07-31 18:47 UTC (History)
1 user (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:


Attachments
Bug 40541: Add missing new line at the end of files when missing (2.04 KB, patch)
2025-07-29 09:55 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40541: Add missing new line at the end of files when missing (18.31 KB, patch)
2025-07-29 10:20 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40541: Add missing new line at the end of files when missing (18.36 KB, patch)
2025-07-29 11:32 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 40541: Add missing new line at the end of files when missing (18.40 KB, patch)
2025-07-29 13:48 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-07-29 09:50:26 UTC
We have insert_final_newline = true to ensure files will contain a new line at the end.
However we have seen commits with "No new line" added in the git log.

We should have a xt test to prevent more occurrences.

We should also have a test at the QA script level: https://gitlab.com/koha-community/qa-test-tools/-/issues/96
Comment 1 Jonathan Druart 2025-07-29 09:55:25 UTC
Created attachment 184789 [details] [review]
Bug 40541: Add missing new line at the end of files when missing

We have insert_final_newline = true to ensure files will contain a new line at the end.
However we have seen commits with "No new line" added in the git log.

We should have a xt test to prevent more occurrences.

We should also have a test at the QA script level: https://gitlab.com/koha-community/qa-test-tools/-/issues/96

Test plan:
  prove xt/find-missing-new-lines-at-the-end-of-file.t
should return green.

Remove the new line at the end of a file, eg.
vim -b mainpage.pl
:set noeol
:wq

Now
  prove xt/find-missing-new-lines-at-the-end-of-file.t
is failing on mainpage.pl.
Comment 2 Jonathan Druart 2025-07-29 10:20:29 UTC
Created attachment 184791 [details] [review]
Bug 40541: Add missing new line at the end of files when missing

We have insert_final_newline = true to ensure files will contain a new line at the end.
However we have seen commits with "No new line" added in the git log.

We should have a xt test to prevent more occurrences.

We should also have a test at the QA script level: https://gitlab.com/koha-community/qa-test-tools/-/issues/96

Test plan:
  prove xt/find-missing-new-lines-at-the-end-of-file.t
should return green.

Remove the new line at the end of a file, eg.
vim -b mainpage.pl
:set noeol
:wq

Now
  prove xt/find-missing-new-lines-at-the-end-of-file.t
is failing on mainpage.pl.
Comment 3 Owen Leonard 2025-07-29 11:32:19 UTC
Created attachment 184794 [details] [review]
Bug 40541: Add missing new line at the end of files when missing

We have insert_final_newline = true to ensure files will contain a new
line at the end. However we have seen commits with "No new line" added
in the git log.

We should have a xt test to prevent more occurrences.

We should also have a test at the QA script level:
https://gitlab.com/koha-community/qa-test-tools/-/issues/96

Test plan:
  prove xt/find-missing-new-lines-at-the-end-of-file.t
should return green.

Remove the new line at the end of a file, eg.
vim -b mainpage.pl
:set noeol
:wq

Now
  prove xt/find-missing-new-lines-at-the-end-of-file.t
is failing on mainpage.pl.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Marcel de Rooy 2025-07-29 13:48:27 UTC
Created attachment 184807 [details] [review]
Bug 40541: Add missing new line at the end of files when missing

We have insert_final_newline = true to ensure files will contain a new
line at the end. However we have seen commits with "No new line" added
in the git log.

We should have a xt test to prevent more occurrences.

We should also have a test at the QA script level:
https://gitlab.com/koha-community/qa-test-tools/-/issues/96

Test plan:
  prove xt/find-missing-new-lines-at-the-end-of-file.t
should return green.

Remove the new line at the end of a file, eg.
vim -b mainpage.pl
:set noeol
:wq

Now
  prove xt/find-missing-new-lines-at-the-end-of-file.t
is failing on mainpage.pl.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Lucas Gass (lukeg) 2025-07-31 18:47:37 UTC
Nice work everyone!

Pushed to main for 25.11