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> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
088927aac1
commit
e9eb20249e
|
|
@ -53,6 +53,7 @@ my $exceptions = {
|
|||
misc/cronjobs/build_browser_and_cloud.pl
|
||||
)
|
||||
],
|
||||
all => [],
|
||||
},
|
||||
js => {
|
||||
tidy => [
|
||||
|
|
@ -71,6 +72,12 @@ my $exceptions = {
|
|||
koha-tmpl/opac-tmpl/bootstrap/js/Gettext.js
|
||||
)
|
||||
],
|
||||
all => [
|
||||
qw(
|
||||
koha-tmpl/intranet-tmpl/lib
|
||||
koha-tmpl/opac-tmpl/lib
|
||||
)
|
||||
],
|
||||
},
|
||||
tt => {
|
||||
tidy => [
|
||||
|
|
@ -81,7 +88,20 @@ my $exceptions = {
|
|||
)
|
||||
],
|
||||
codespell => [],
|
||||
all => [],
|
||||
},
|
||||
yml => {
|
||||
all => [],
|
||||
},
|
||||
css => {
|
||||
all => [
|
||||
qw(
|
||||
koha-tmpl/intranet-tmpl/lib
|
||||
koha-tmpl/opac-tmpl/lib
|
||||
)
|
||||
],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
=head1 METHODS
|
||||
|
|
@ -167,6 +187,38 @@ sub ls_tt_files {
|
|||
return @files;
|
||||
}
|
||||
|
||||
=head2 ls_yml_files
|
||||
|
||||
my @yml_files = $file_manager->ls_yml_files();
|
||||
|
||||
Lists YAML files (with extensions .yml, .yaml) in the repository, excluding those specified in the exceptions.
|
||||
|
||||
=cut
|
||||
|
||||
sub ls_yml_files {
|
||||
my ($self) = @_;
|
||||
my $cmd = sprintf q{git ls-files '*.yml' '*.yaml' %s}, $self->build_git_exclude('yml');
|
||||
my @files = qx{$cmd};
|
||||
chomp for @files;
|
||||
return @files;
|
||||
}
|
||||
|
||||
=head2 ls_css_files
|
||||
|
||||
my @css_files = $file_manager->ls_css_files();
|
||||
|
||||
Lists CSS files (with extensions .css) in the repository, excluding those specified in the exceptions.
|
||||
|
||||
=cut
|
||||
|
||||
sub ls_css_files {
|
||||
my ($self) = @_;
|
||||
my $cmd = sprintf q{git ls-files '*.css' %s}, $self->build_git_exclude('css');
|
||||
my @files = qx{$cmd};
|
||||
chomp for @files;
|
||||
return @files;
|
||||
}
|
||||
|
||||
=head2 get_filetype
|
||||
|
||||
my $filetype = $file_manager->get_filetype($filename);
|
||||
|
|
|
|||
|
|
@ -84,4 +84,4 @@ properties:
|
|||
- null
|
||||
description: "When items should be created for orders in this basket (Options:
|
||||
'ordering', 'receiving', 'cataloguing'. Null means system wide config)"
|
||||
additionalProperties: false
|
||||
additionalProperties: false
|
||||
|
|
|
|||
|
|
@ -16,4 +16,4 @@ properties:
|
|||
description: Context of the ruleset
|
||||
additionalProperties: true
|
||||
required:
|
||||
- context
|
||||
- context
|
||||
|
|
|
|||
|
|
@ -57,4 +57,4 @@ properties:
|
|||
description: EDIFACT file name
|
||||
errors:
|
||||
type: array
|
||||
additionalProperties: false
|
||||
additionalProperties: false
|
||||
|
|
|
|||
|
|
@ -33,4 +33,4 @@ additionalProperties: false
|
|||
required:
|
||||
- usage_data_provider_id
|
||||
- filename
|
||||
- file_content
|
||||
- file_content
|
||||
|
|
|
|||
|
|
@ -44,4 +44,4 @@ additionalProperties: false
|
|||
required:
|
||||
- filename
|
||||
- patron_id
|
||||
- counter_files_id
|
||||
- counter_files_id
|
||||
|
|
|
|||
|
|
@ -61,4 +61,4 @@ properties:
|
|||
type: array
|
||||
description: usage yus
|
||||
items:
|
||||
$ref: erm_usage_yus.yaml
|
||||
$ref: erm_usage_yus.yaml
|
||||
|
|
|
|||
|
|
@ -15,4 +15,4 @@ properties:
|
|||
additionalProperties: false
|
||||
required:
|
||||
- report_name
|
||||
- report_url_params
|
||||
- report_url_params
|
||||
|
|
|
|||
|
|
@ -67,4 +67,4 @@ required:
|
|||
- license_id
|
||||
- name
|
||||
- status
|
||||
- type
|
||||
- type
|
||||
|
|
|
|||
|
|
@ -69,4 +69,4 @@ properties:
|
|||
additionalProperties: false
|
||||
required:
|
||||
- title_id
|
||||
- usage_data_provider_id
|
||||
- usage_data_provider_id
|
||||
|
|
|
|||
|
|
@ -65,4 +65,4 @@ properties:
|
|||
additionalProperties: false
|
||||
required:
|
||||
- title_id
|
||||
- usage_data_provider_id
|
||||
- usage_data_provider_id
|
||||
|
|
|
|||
|
|
@ -15,4 +15,4 @@ properties:
|
|||
description: value of the additional field
|
||||
type: string
|
||||
|
||||
additionalProperties: false
|
||||
additionalProperties: false
|
||||
|
|
|
|||
|
|
@ -107,4 +107,4 @@
|
|||
$ref: "../swagger.yaml#/definitions/error"
|
||||
x-koha-authorization:
|
||||
permissions:
|
||||
acquisition: order_manage
|
||||
acquisition: order_manage
|
||||
|
|
|
|||
|
|
@ -68,4 +68,4 @@
|
|||
$ref: "../swagger.yaml#/definitions/error"
|
||||
x-koha-authorization:
|
||||
permissions:
|
||||
acquisition: edi_manage
|
||||
acquisition: edi_manage
|
||||
|
|
|
|||
|
|
@ -112,4 +112,4 @@
|
|||
"503":
|
||||
description: Under maintenance
|
||||
schema:
|
||||
$ref: "../swagger.yaml#/definitions/error"
|
||||
$ref: "../swagger.yaml#/definitions/error"
|
||||
|
|
|
|||
|
|
@ -919,4 +919,4 @@
|
|||
"503":
|
||||
description: Under maintenance
|
||||
schema:
|
||||
$ref: "../swagger.yaml#/definitions/error"
|
||||
$ref: "../swagger.yaml#/definitions/error"
|
||||
|
|
|
|||
|
|
@ -454,4 +454,4 @@
|
|||
"503":
|
||||
description: Under maintenance
|
||||
schema:
|
||||
$ref: "../swagger.yaml#/definitions/error"
|
||||
$ref: "../swagger.yaml#/definitions/error"
|
||||
|
|
|
|||
|
|
@ -158,4 +158,4 @@
|
|||
$ref: "../swagger.yaml#/definitions/error"
|
||||
x-koha-authorization:
|
||||
permissions:
|
||||
- circulate: circulate_remaining_permissions
|
||||
- circulate: circulate_remaining_permissions
|
||||
|
|
|
|||
|
|
@ -78,4 +78,4 @@ tables:
|
|||
- code: "PROCESSING_FOUND"
|
||||
description: "Lost item processing fee refund"
|
||||
can_be_added_manually: "0"
|
||||
is_system: "1"
|
||||
is_system: "1"
|
||||
|
|
|
|||
|
|
@ -135,4 +135,4 @@ tables:
|
|||
can_be_invoiced: "0"
|
||||
can_be_sold: "0"
|
||||
default_amount: ~
|
||||
is_system: "1"
|
||||
is_system: "1"
|
||||
|
|
|
|||
|
|
@ -39,4 +39,4 @@ tables:
|
|||
|
||||
- code: "UNKNOWN"
|
||||
name: "Unknown"
|
||||
is_system: "1"
|
||||
is_system: "1"
|
||||
|
|
|
|||
|
|
@ -97,4 +97,4 @@ sql_statements:
|
|||
- "UPDATE marc_subfield_structure SET hidden ='-5' WHERE tagfield = '952' AND tagsubfield = 'j' AND frameworkcode = 'FA';"
|
||||
- "UPDATE marc_subfield_structure SET hidden ='-6' WHERE tagfield = '952' AND tagsubfield = 't' AND frameworkcode = 'FA';"
|
||||
- "UPDATE marc_subfield_structure SET hidden ='-6' WHERE tagfield = '952' AND tagsubfield = 'u' AND frameworkcode = 'FA';"
|
||||
- "UPDATE marc_subfield_structure SET hidden ='-6' WHERE tagfield = '952' AND tagsubfield = 'w' AND frameworkcode = 'FA';"
|
||||
- "UPDATE marc_subfield_structure SET hidden ='-6' WHERE tagfield = '952' AND tagsubfield = 'w' AND frameworkcode = 'FA';"
|
||||
|
|
|
|||
|
|
@ -1220,4 +1220,4 @@ tables:
|
|||
|
||||
- category: "RELTERMS"
|
||||
authorised_value: "wts"
|
||||
lib: "Writer of television story"
|
||||
lib: "Writer of television story"
|
||||
|
|
|
|||
|
|
@ -102,4 +102,4 @@
|
|||
.parents{
|
||||
display:inline;
|
||||
cursor:crosshair;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,4 +381,4 @@ p#upload_image {
|
|||
|
||||
#catalog_detail .col-sm-push-2 {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@ body {
|
|||
width: 100%;
|
||||
border-top: 1px solid #b9d8d9;
|
||||
background-color: #e6f0f2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
body, td, pre {
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,4 +102,4 @@
|
|||
.parents{
|
||||
display:inline;
|
||||
cursor:crosshair;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ pre {
|
|||
.xmlverb-text { color: #000000; font-weight: bold }
|
||||
.xmlverb-comment { color: #006600; font-style: italic }
|
||||
.xmlverb-pi-name { color: #006600; font-style: italic }
|
||||
.xmlverb-pi-content { color: #006666; font-style: italic }
|
||||
.xmlverb-pi-content { color: #006666; font-style: italic }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/perl
|
||||
use Modern::Perl;
|
||||
use Test::PerlTidy;
|
||||
use Test::More;
|
||||
use Test::NoWarnings;
|
||||
|
||||
use Koha::Devel::Files;
|
||||
|
||||
my $dev_files = Koha::Devel::Files->new( { context => 'all' } );
|
||||
my @files;
|
||||
push @files, $dev_files->ls_perl_files;
|
||||
push @files, $dev_files->ls_tt_files;
|
||||
push @files, $dev_files->ls_js_files;
|
||||
push @files, $dev_files->ls_yml_files;
|
||||
push @files, $dev_files->ls_css_files;
|
||||
|
||||
plan tests => scalar @files + 1;
|
||||
|
||||
for my $file (@files) {
|
||||
if ( -z $file ) {
|
||||
|
||||
# File is empty
|
||||
ok(1);
|
||||
next;
|
||||
}
|
||||
open my $fh, '<', $file or die "Can't open file ($file): $!";
|
||||
seek $fh, -1, 2 or die "Can't seek ($file): $!";
|
||||
read $fh, my $char, 1;
|
||||
close $fh;
|
||||
is( $char, "\n", "$file should end with a new line" );
|
||||
}
|
||||
Loading…
Reference in New Issue