From e379fa195c6e391767ea9d1c659c0e63b0077991 Mon Sep 17 00:00:00 2001 From: Olivier Vernin Date: Fri, 5 Jul 2024 14:54:58 +0200 Subject: [PATCH] Cleanup (#110) * clean: remove unneeded function Signed-off-by: Olivier Vernin * fix: golangci deprecation Signed-off-by: Olivier Vernin --------- Signed-off-by: Olivier Vernin --- .golangci.yml | 11 ++++++----- pkg/server/scmDBQuery.go | 38 -------------------------------------- 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 78c1697c..3ba4835d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -91,6 +91,11 @@ linters: - unused # - whitespace issues: + exclude-dirs: + - test/testdata_etc + - internal/cache + - internal/renameio + - internal/robustio # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: - path: _test\.go @@ -106,8 +111,4 @@ issues: text: "unnecessaryDefer:" run: timeout: 5m - skip-dirs: - - test/testdata_etc - - internal/cache - - internal/renameio - - internal/robustio + diff --git a/pkg/server/scmDBQuery.go b/pkg/server/scmDBQuery.go index ab18923e..ca7d59c3 100644 --- a/pkg/server/scmDBQuery.go +++ b/pkg/server/scmDBQuery.go @@ -8,44 +8,6 @@ import ( "github.com/updatecli/udash/pkg/database" ) -// dbGetSCMFromTarget represents a specific scm configuration from the database. -func dbGetSCMFromTarget() ([]DatabaseSCMRow, error) { - - query := ` - SELECT j.targets -> 'Scm' ->> 'URL', j.targets -> 'Scm' -> 'Branch' ->> 'Target' - FROM ( - SELECT jsonb_path_query(data::jsonb, '$.Targets[*].*') as targets - FROM pipelineReports - ) j group by 1,2;` - - rows, err := database.DB.Query(context.Background(), query) - if err != nil { - logrus.Errorf("get scm from pipeline target(s): %q\n\t%s", query, err) - return nil, err - } - - results := []DatabaseSCMRow{} - - for rows.Next() { - r := DatabaseSCMRow{} - - err = rows.Scan(&r.URL, &r.Branch) - if err != nil { - logrus.Errorf("scanning scm row failed: %s", err) - continue - } - - // No need to return empty git url - if r.URL == "" { - continue - } - - results = append(results, r) - } - - return results, nil -} - func dbInsertSCM(url, branch string) (string, error) { var ID uuid.UUID