From 64fed3553afad1ad6743b3fd821f314bb732b13b Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:47:29 +1100 Subject: [PATCH] Lint fixes (#5476) * Fix lint errors * Bump lint action version --- .github/workflows/golangci-lint.yml | 2 +- pkg/sqlite/criterion_handlers.go | 12 ++++++------ pkg/sqlite/gallery_filter.go | 12 ++++++------ pkg/utils/vtt.go | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index cbb3b021f..ab21c1c17 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -38,7 +38,7 @@ jobs: run: docker exec -t build /bin/bash -c "make generate-backend" - name: Run golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version version: latest diff --git a/pkg/sqlite/criterion_handlers.go b/pkg/sqlite/criterion_handlers.go index e021bd175..55ff31fca 100644 --- a/pkg/sqlite/criterion_handlers.go +++ b/pkg/sqlite/criterion_handlers.go @@ -285,20 +285,20 @@ func resolutionCriterionHandler(resolution *models.ResolutionCriterionInput, hei addJoinFn(f) } - min := resolution.Value.GetMinResolution() - max := resolution.Value.GetMaxResolution() + mn := resolution.Value.GetMinResolution() + mx := resolution.Value.GetMaxResolution() widthHeight := fmt.Sprintf("MIN(%s, %s)", widthColumn, heightColumn) switch resolution.Modifier { case models.CriterionModifierEquals: - f.addWhere(fmt.Sprintf("%s BETWEEN %d AND %d", widthHeight, min, max)) + f.addWhere(fmt.Sprintf("%s BETWEEN %d AND %d", widthHeight, mn, mx)) case models.CriterionModifierNotEquals: - f.addWhere(fmt.Sprintf("%s NOT BETWEEN %d AND %d", widthHeight, min, max)) + f.addWhere(fmt.Sprintf("%s NOT BETWEEN %d AND %d", widthHeight, mn, mx)) case models.CriterionModifierLessThan: - f.addWhere(fmt.Sprintf("%s < %d", widthHeight, min)) + f.addWhere(fmt.Sprintf("%s < %d", widthHeight, mn)) case models.CriterionModifierGreaterThan: - f.addWhere(fmt.Sprintf("%s > %d", widthHeight, max)) + f.addWhere(fmt.Sprintf("%s > %d", widthHeight, mx)) } } } diff --git a/pkg/sqlite/gallery_filter.go b/pkg/sqlite/gallery_filter.go index ad5ac592a..18718c511 100644 --- a/pkg/sqlite/gallery_filter.go +++ b/pkg/sqlite/gallery_filter.go @@ -414,20 +414,20 @@ func (qb *galleryFilterHandler) averageResolutionCriterionHandler(resolution *mo f.addLeftJoin("images_files", "", "images.id = images_files.image_id") f.addLeftJoin("image_files", "", "images_files.file_id = image_files.file_id") - min := resolution.Value.GetMinResolution() - max := resolution.Value.GetMaxResolution() + mn := resolution.Value.GetMinResolution() + mx := resolution.Value.GetMaxResolution() const widthHeight = "avg(MIN(image_files.width, image_files.height))" switch resolution.Modifier { case models.CriterionModifierEquals: - f.addHaving(fmt.Sprintf("%s BETWEEN %d AND %d", widthHeight, min, max)) + f.addHaving(fmt.Sprintf("%s BETWEEN %d AND %d", widthHeight, mn, mx)) case models.CriterionModifierNotEquals: - f.addHaving(fmt.Sprintf("%s NOT BETWEEN %d AND %d", widthHeight, min, max)) + f.addHaving(fmt.Sprintf("%s NOT BETWEEN %d AND %d", widthHeight, mn, mx)) case models.CriterionModifierLessThan: - f.addHaving(fmt.Sprintf("%s < %d", widthHeight, min)) + f.addHaving(fmt.Sprintf("%s < %d", widthHeight, mn)) case models.CriterionModifierGreaterThan: - f.addHaving(fmt.Sprintf("%s > %d", widthHeight, max)) + f.addHaving(fmt.Sprintf("%s > %d", widthHeight, mx)) } } } diff --git a/pkg/utils/vtt.go b/pkg/utils/vtt.go index 7af094c49..8d9948a74 100644 --- a/pkg/utils/vtt.go +++ b/pkg/utils/vtt.go @@ -26,12 +26,12 @@ func GetVTTTime(fracSeconds float64) string { return "00:00:00.000" } - var msec, sec, min, hour int + var msec, sec, mnt, hour int msec = int(fracSeconds * 1000) sec, msec = norm(sec, msec, 1000) - min, sec = norm(min, sec, 60) - hour, min = norm(hour, min, 60) + mnt, sec = norm(mnt, sec, 60) + hour, mnt = norm(hour, mnt, 60) - return fmt.Sprintf("%02d:%02d:%02d.%03d", hour, min, sec, msec) + return fmt.Sprintf("%02d:%02d:%02d.%03d", hour, mnt, sec, msec) }