Skip to content

Commit 4d2286d

Browse files
Final lint changes
1 parent 451c75e commit 4d2286d

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

Diff for: cmd/root.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Produces:
5959
6060
NOTE the minimum supported SAST version is 9.3. SAST installations below this version should be upgraded in order to run this export tool.
6161
`,
62-
Run: func(cmd *cobra.Command, args []string) {
62+
Run: func(cmd *cobra.Command, _ []string) {
6363

6464
// Validate simIDVersion if provided
6565
if simIDVersion < 0 || simIDVersion > 2 {

Diff for: cmd/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var versionCmd = &cobra.Command{
1515
Use: "version",
1616
Short: fmt.Sprintf("Print the version number of %s", productName),
1717
Long: fmt.Sprintf(`All software has versions. This is %s's`, productName),
18-
Run: func(cmd *cobra.Command, args []string) {
18+
Run: func(_ *cobra.Command, _ []string) {
1919
fmt.Printf("%s %s+%s\n", productName, productVersion, productBuild)
2020
},
2121
}

Diff for: internal/integration/rest/utils.go

+22-22
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ func GetFilterForProjects(fromDate, teamName, projectIDs string) string {
2525
return getProjectFilterForEmptyDate(projectIDs, teamName)
2626
}
2727
if teamName == "" {
28-
return fmt.Sprintf("CreatedDate gt %s and %s", fromDate, getProjectIdsFilter(projectIDs))
28+
return fmt.Sprintf("CreatedDate gt %s and %s", fromDate, getProjectIDsFilter(projectIDs))
2929
}
3030
if projectIDs == "" {
3131
return fmt.Sprintf("CreatedDate gt %s and %s", fromDate, getTeamFilter(teamName))
3232
}
3333
return fmt.Sprintf("CreatedDate gt %s and %s and %s", fromDate, getTeamFilter(teamName),
34-
getProjectIdsFilter(projectIDs))
34+
getProjectIDsFilter(projectIDs))
3535
}
3636

3737
// GetFilterForProjectsWithLastScan get filter string for projects list with last scan
@@ -43,53 +43,53 @@ func GetFilterForProjectsWithLastScan(fromDate, teamName, projectIDs string) str
4343
return getProjectFilterForEmptyDate(projectIDs, teamName)
4444
}
4545
if teamName == "" {
46-
return fmt.Sprintf("LastScan/ScanCompletedOn gt %s and %s", fromDate, getProjectIdsFilter(projectIDs))
46+
return fmt.Sprintf("LastScan/ScanCompletedOn gt %s and %s", fromDate, getProjectIDsFilter(projectIDs))
4747
}
4848
if projectIDs == "" {
4949
return fmt.Sprintf("LastScan/ScanCompletedOn gt %s and %s", fromDate, getTeamFilter(teamName))
5050
}
5151
return fmt.Sprintf("LastScan/ScanCompletedOn gt %s and %s and %s", fromDate, getTeamFilter(teamName),
52-
getProjectIdsFilter(projectIDs))
52+
getProjectIDsFilter(projectIDs))
5353
}
5454

5555
// getProjectFilterForEmptyDate get project filter when date empty
5656
func getProjectFilterForEmptyDate(projectIDs, teamName string) string {
5757
if teamName == "" {
58-
return getProjectIdsFilter(projectIDs)
58+
return getProjectIDsFilter(projectIDs)
5959
}
60-
return fmt.Sprintf("%s and %s", getProjectIdsFilter(projectIDs), getTeamFilter(teamName))
60+
return fmt.Sprintf("%s and %s", getProjectIDsFilter(projectIDs), getTeamFilter(teamName))
6161
}
6262

6363
// getTeamFilter get filter string for team
6464
func getTeamFilter(teamName string) string {
6565
return fmt.Sprintf("OwningTeam/FullName eq '%s'", teamName)
6666
}
6767

68-
// getProjectIdsFilter get filter string for project-id option
69-
func getProjectIdsFilter(projectIds string) string {
70-
if matched, _ := regexp.MatchString(`^\d+$`, projectIds); matched {
71-
return fmt.Sprintf("Id eq %s", projectIds)
68+
// getProjectIDsFilter get filter string for project-id option
69+
func getProjectIDsFilter(projectIDs string) string {
70+
if matched, _ := regexp.MatchString(`^\d+$`, projectIDs); matched {
71+
return fmt.Sprintf("Id eq %s", projectIDs)
7272
}
73-
if matched, _ := regexp.MatchString(`^\d+(,\s?\d+)+$`, projectIds); matched {
74-
return fmt.Sprintf("Id in (%s)", projectIds)
73+
if matched, _ := regexp.MatchString(`^\d+(,\s?\d+)+$`, projectIDs); matched {
74+
return fmt.Sprintf("Id in (%s)", projectIDs)
7575
}
76-
if matched, _ := regexp.MatchString(`^\d+\s?-\s?\d+$`, projectIds); matched {
77-
ids := strings.Split(projectIds, "-")
78-
min, max := getMinMax(ids)
79-
return fmt.Sprintf("Id ge %d and Id le %d", min, max)
76+
if matched, _ := regexp.MatchString(`^\d+\s?-\s?\d+$`, projectIDs); matched {
77+
ids := strings.Split(projectIDs, "-")
78+
minValue, maxValue := getMinMax(ids)
79+
return fmt.Sprintf("Id ge %d and Id le %d", minValue, maxValue)
8080
}
8181

8282
log.Warn().Msg("--project-id has wrong param. It should be like --project-id 1 or 1,3,8 or 1-3")
8383
return "Id gt 0"
8484
}
8585

8686
// getMinMax get min and max values
87-
func getMinMax(ids []string) (min, max int) {
88-
min, _ = strconv.Atoi(strings.Trim(ids[0], " "))
89-
max, _ = strconv.Atoi(strings.Trim(ids[1], " "))
90-
if min > max {
91-
min, max = max, min
87+
func getMinMax(ids []string) (minValue, maxValue int) {
88+
minValue, _ = strconv.Atoi(strings.Trim(ids[0], " "))
89+
maxValue, _ = strconv.Atoi(strings.Trim(ids[1], " "))
90+
if minValue > maxValue {
91+
minValue, maxValue = maxValue, minValue
9292
}
9393

94-
return min, max
94+
return minValue, maxValue
9595
}

Diff for: internal/process.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -830,14 +830,14 @@ func getRetryHTTPClient() *retryablehttp.Client {
830830
RetryMax: httpRetryMax,
831831
CheckRetry: retryablehttp.DefaultRetryPolicy,
832832
Backoff: retryablehttp.DefaultBackoff,
833-
RequestLogHook: func(logger retryablehttp.Logger, request *http.Request, i int) {
833+
RequestLogHook: func(_ retryablehttp.Logger, request *http.Request, i int) {
834834
log.Debug().
835835
Str("method", request.Method).
836836
Str("url", request.URL.String()).
837837
Int("attempt", i+1).
838838
Msg("request")
839839
},
840-
ResponseLogHook: func(logger retryablehttp.Logger, response *http.Response) {
840+
ResponseLogHook: func(_ retryablehttp.Logger, response *http.Response) {
841841
log.Debug().
842842
Str("method", response.Request.Method).
843843
Str("url", response.Request.URL.String()).

0 commit comments

Comments
 (0)