Skip to content

Commit

Permalink
Cleanup (#110)
Browse files Browse the repository at this point in the history
* clean: remove unneeded function

Signed-off-by: Olivier Vernin <[email protected]>

* fix: golangci deprecation

Signed-off-by: Olivier Vernin <[email protected]>

---------

Signed-off-by: Olivier Vernin <[email protected]>
  • Loading branch information
olblak authored Jul 5, 2024
1 parent 8164512 commit e379fa1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 43 deletions.
11 changes: 6 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -106,8 +111,4 @@ issues:
text: "unnecessaryDefer:"
run:
timeout: 5m
skip-dirs:
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio

38 changes: 0 additions & 38 deletions pkg/server/scmDBQuery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e379fa1

Please sign in to comment.