Lines 1-4
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#/usr/bin/perl |
2 |
|
2 |
|
3 |
# This file is part of Koha. |
3 |
# This file is part of Koha. |
4 |
# |
4 |
# |
Lines 22-38
use FindBin();
Link Here
|
22 |
use Data::Dumper qw( Dumper ); |
22 |
use Data::Dumper qw( Dumper ); |
23 |
use Test::More tests => 1; |
23 |
use Test::More tests => 1; |
24 |
|
24 |
|
25 |
my @js_files; |
25 |
my $cmd = q{git grep -l '/\* keep tidy \*/' -- '*.js'}; |
26 |
push @js_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js'`; |
26 |
my @js_files = qx{$cmd}; |
27 |
|
27 |
|
28 |
my @not_tidy; |
28 |
my @not_tidy; |
29 |
foreach my $filepath (@js_files) { |
29 |
foreach my $filepath (@js_files) { |
30 |
chomp $filepath; |
30 |
chomp $filepath; |
31 |
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --arrow-parens avoid $filepath}; |
31 |
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --arrow-parens avoid $filepath}; |
32 |
my $content = read_file $filepath; |
32 |
my $content = read_file $filepath; |
33 |
if ( $content ne $tidy ) { |
33 |
if ( $content ne $tidy ) { |
34 |
push @not_tidy, $filepath; |
34 |
push @not_tidy, $filepath; |
35 |
} |
35 |
} |
36 |
} |
36 |
} |
37 |
|
37 |
|
38 |
is(scalar(@not_tidy), 0, 'No .js file should be messy') or diag Dumper \@not_tidy; |
38 |
is( scalar(@not_tidy), 0, sprintf( 'No .js file should be messy %s/%s', scalar(@not_tidy), scalar(@js_files) ) ) |
|
|
39 |
or diag Dumper \@not_tidy; |
39 |
- |
|
|