Skip to content

Commit e379fa1

Browse files
authored
Cleanup (#110)
* clean: remove unneeded function Signed-off-by: Olivier Vernin <olivier.vernin@suse.com> * fix: golangci deprecation Signed-off-by: Olivier Vernin <olivier.vernin@suse.com> --------- Signed-off-by: Olivier Vernin <olivier.vernin@suse.com>
1 parent 8164512 commit e379fa1

2 files changed

Lines changed: 6 additions & 43 deletions

File tree

.golangci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ linters:
9191
- unused
9292
# - whitespace
9393
issues:
94+
exclude-dirs:
95+
- test/testdata_etc
96+
- internal/cache
97+
- internal/renameio
98+
- internal/robustio
9499
# Excluding configuration per-path, per-linter, per-text and per-source
95100
exclude-rules:
96101
- path: _test\.go
@@ -106,8 +111,4 @@ issues:
106111
text: "unnecessaryDefer:"
107112
run:
108113
timeout: 5m
109-
skip-dirs:
110-
- test/testdata_etc
111-
- internal/cache
112-
- internal/renameio
113-
- internal/robustio
114+

pkg/server/scmDBQuery.go

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,6 @@ import (
88
"github.com/updatecli/udash/pkg/database"
99
)
1010

11-
// dbGetSCMFromTarget represents a specific scm configuration from the database.
12-
func dbGetSCMFromTarget() ([]DatabaseSCMRow, error) {
13-
14-
query := `
15-
SELECT j.targets -> 'Scm' ->> 'URL', j.targets -> 'Scm' -> 'Branch' ->> 'Target'
16-
FROM (
17-
SELECT jsonb_path_query(data::jsonb, '$.Targets[*].*') as targets
18-
FROM pipelineReports
19-
) j group by 1,2;`
20-
21-
rows, err := database.DB.Query(context.Background(), query)
22-
if err != nil {
23-
logrus.Errorf("get scm from pipeline target(s): %q\n\t%s", query, err)
24-
return nil, err
25-
}
26-
27-
results := []DatabaseSCMRow{}
28-
29-
for rows.Next() {
30-
r := DatabaseSCMRow{}
31-
32-
err = rows.Scan(&r.URL, &r.Branch)
33-
if err != nil {
34-
logrus.Errorf("scanning scm row failed: %s", err)
35-
continue
36-
}
37-
38-
// No need to return empty git url
39-
if r.URL == "" {
40-
continue
41-
}
42-
43-
results = append(results, r)
44-
}
45-
46-
return results, nil
47-
}
48-
4911
func dbInsertSCM(url, branch string) (string, error) {
5012

5113
var ID uuid.UUID

0 commit comments

Comments
 (0)