Bug 38664: Remove 'keep tidy' for JS files

We now want to check (almost) all JS files

On the tidy branch:
xt/js_tidy.t .. ok
All tests successful.
Files=1, Tests=175, 129 wallclock secs ( 0.07 usr  0.01 sys + 103.69 cusr 37.68 csys = 141.45 CPU)
Result: PASS

real    2m8.187s
user    1m43.806s
sys     0m37.730s

xt/vue_tidy.t .. ok
All tests successful.
Files=1, Tests=75, 60 wallclock secs ( 0.04 usr  0.01 sys + 53.80 cusr 17.22 csys = 71.07 CPU)
Result: PASS

real    1m0.137s
user    0m53.891s
sys     0m17.286s

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2025-01-14 11:23:06 +01:00 committed by Katrin Fischer
parent b9affd17cf
commit 9fe7434eaa
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
21 changed files with 11 additions and 61 deletions

View File

@ -1,4 +1,3 @@
/* keep tidy */
import ArticleRequestAPIClient from "./article-request-api-client.js";
import AVAPIClient from "./authorised-value-api-client.js";
import CataloguingAPIClient from "./cataloguing-api-client.js";

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class ArticleRequestAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class AVAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class CataloguingAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class CirculationAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class ClubAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class CoverImageAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
class Dialog {
constructor(options = {}) {}

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class LocalizationAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class PatronAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class RecallAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class SysprefAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
import HttpClient from "./http-client.js";
export class TicketAPIClient extends HttpClient {

View File

@ -1,4 +1,3 @@
/* keep tidy */
$(document).ready(function () {
$("body").on("click", ".submit-form-link", function (e) {
e.preventDefault();

View File

@ -1,4 +1,3 @@
/* keep tidy */
$(document).ready(function () {
// Pre-populate empty message with template
$("#addConcernModal").on("show.bs.modal", function (e) {

View File

@ -1,4 +1,3 @@
/* keep tidy */
$(document).ready(function () {
document.addEventListener("click", function (event) {
const detailTrigger = event.target.closest(".detail-trigger");

View File

@ -1,4 +1,3 @@
/* keep tidy */
let dataFetched = false;
let bookable_items,
bookings,

View File

@ -1,4 +1,3 @@
/* keep tidy */
/* global KOHA CodeMirror to_highlight search_jumped humanMsg dataTablesDefaults themelang */
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX

View File

@ -1,4 +1,3 @@
/* keep tidy */
// Bookings
var bookings_table;
$(document).ready(function () {

View File

@ -17,23 +17,16 @@
use Modern::Perl;
use File::Slurp qw( read_file );
use File::Find;
use FindBin();
use Data::Dumper qw( Dumper );
use Test::More tests => 1;
use Test::More;
my $cmd = q{git grep -l '/\* keep tidy \*/' -- '*.js'};
my @js_files = qx{$cmd};
my @js_files =
qx{git ls-files '*.js' '*.ts' ':(exclude)koha-tmpl/intranet-tmpl/lib' ':(exclude)koha-tmpl/intranet-tmpl/js/Gettext.js' ':(exclude)koha-tmpl/opac-tmpl/lib' ':(exclude)Koha/ILL/Backend/'};
plan tests => scalar @js_files;
my @not_tidy;
foreach my $filepath (@js_files) {
chomp $filepath;
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --arrow-parens avoid $filepath};
my $content = read_file $filepath;
if ( $content ne $tidy ) {
push @not_tidy, $filepath;
}
ok( $content eq $tidy, "$filepath should be kept tidy" );
}
is( scalar(@not_tidy), 0, sprintf( 'No .js file should be messy %s/%s', scalar(@not_tidy), scalar(@js_files) ) )
or diag Dumper \@not_tidy;

View File

@ -17,39 +17,15 @@
use Modern::Perl;
use File::Slurp qw( read_file );
use File::Find;
use FindBin();
use Data::Dumper qw( Dumper );
use Test::More tests => 2;
use Test::More;
my @vue_files;
push @vue_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.vue'`;
my @js_files;
push @js_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.js'`;
push @js_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.ts'`;
push @js_files, `git ls-files 't/cypress/integration/*.ts'`;
my @vue_files = `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.vue'`;
plan tests => scalar @vue_files;
my @not_tidy;
foreach my $filepath (@vue_files) {
chomp $filepath;
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --semi false --arrow-parens avoid $filepath};
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --semi false --arrow-parens avoid $filepath};
my $content = read_file $filepath;
if ( $content ne $tidy ) {
push @not_tidy, $filepath;
}
ok( $content eq $tidy, "$filepath should be kept tidy" );
}
is(scalar(@not_tidy), 0, 'No .vue file should be messy') or diag Dumper \@not_tidy;
@not_tidy = ();
foreach my $filepath (@js_files) {
chomp $filepath;
my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --arrow-parens avoid $filepath};
my $content = read_file $filepath;
if ( $content ne $tidy ) {
push @not_tidy, $filepath;
}
}
is(scalar(@not_tidy), 0, 'No js file from vue directory should be messy') or diag Dumper \@not_tidy;