Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into add-xsc-analytics-to…
Browse files Browse the repository at this point in the history
…-docker-scan-command

# Conflicts:
#	commands/curation/curationaudit.go
#	commands/scan/downloadindexer.go
#	commands/xray/offlineupdate/offlineupdate.go
#	formats/sarifutils/sarifutils.go
#	utils/severityutils/severity.go
  • Loading branch information
orz25 committed Aug 19, 2024
2 parents 8ed51c0 + fdda815 commit c9af8da
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions commands/curation/curationaudit.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,8 @@ func (ca *CurationAuditCommand) getRepoParams(projectType project.ProjectType) (
return nil, err
}
if !exists {
return nil, errorutils.CheckError(errors.New("no config file was found! Before running the " + projectType.String() + " command on a " +
"project for the first time, the project should be configured using the 'jf " + projectType.String() + "c' command"))
return nil, errorutils.CheckErrorf("no config file was found! Before running the %s command on a "+
"project for the first time, the project should be configured using the 'jf %s c' command", projectType.String(), projectType.String())
}
vConfig, err := project.ReadConfigFile(configFilePath, project.YAML)
if err != nil {
Expand Down Expand Up @@ -799,7 +799,7 @@ func GetCurationOutputFormat(formatFlagVal string) (format outFormat.OutputForma
case string(outFormat.Json):
format = outFormat.Json
default:
err = errorutils.CheckError(errors.New("only the following output formats are supported: " + coreutils.ListToText(CurationOutputFormats)))
err = errorutils.CheckError(errors.New("only the following output formats are supported: %s", coreutils.ListToText(CurationOutputFormats)))

Check failure on line 802 in commands/curation/curationaudit.go

View workflow job for this annotation

GitHub Actions / Static-Check

too many arguments in call to errors.New

Check failure on line 802 in commands/curation/curationaudit.go

View workflow job for this annotation

GitHub Actions / Static-Check

too many arguments in call to errors.New

Check failure on line 802 in commands/curation/curationaudit.go

View workflow job for this annotation

GitHub Actions / Static-Check

too many arguments in call to errors.New
}
}
return
Expand Down
2 changes: 1 addition & 1 deletion commands/scan/downloadindexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func downloadIndexer(xrayManager *xray.XrayServicesManager, indexerDirPath, inde
}
if err = errorutils.CheckResponseStatus(resp, http.StatusOK); err != nil {
if resp.StatusCode == http.StatusUnauthorized {
err = errors.New(err.Error() + "\nHint: It appears that the credentials provided do not have sufficient permissions for JFrog Xray. This could be due to either incorrect credentials or limited permissions restricted to Artifactory only.")
err = fmt.Errorf("%s \nHint: It appears that the credentials provided do not have sufficient permissions for JFrog Xray. This could be due to either incorrect credentials or limited permissions restricted to Artifactory only.", err.Error())
}
return "", fmt.Errorf("failed while attempting to download '%s':\n%s", url, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion commands/xray/offlineupdate/offlineupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func getFilesList(updatesUrl string, flags *OfflineUpdatesFlags) (vulnerabilitie
var urls FilesList
err = json.Unmarshal(body, &urls)
if err != nil {
err = errorutils.CheckError(errors.New("Failed parsing json response: " + string(body)))
err = errorutils.CheckErrorf("Failed parsing json response: %s", string(body))
return
}

Expand Down
3 changes: 1 addition & 2 deletions formats/sarifutils/sarifutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sarifutils

import (
"encoding/json"
"errors"
"fmt"
"path/filepath"
"strings"
Expand Down Expand Up @@ -31,7 +30,7 @@ func ConvertSarifReportToString(report *sarif.Report) (sarifStr string, err erro
func ReadScanRunsFromFile(fileName string) (sarifRuns []*sarif.Run, err error) {
report, err := sarif.Open(fileName)
if errorutils.CheckError(err) != nil {
err = errors.New("can't read valid Sarif run from " + fileName + ": " + err.Error())
err = fmt.Errorf("can't read valid Sarif run from %s: %s", fileName, err.Error())
return
}
sarifRuns = report.Runs
Expand Down
3 changes: 1 addition & 2 deletions utils/severityutils/severity.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package severityutils

import (
"errors"
"strings"

"github.com/gookit/color"
Expand Down Expand Up @@ -193,7 +192,7 @@ func ParseSeverity(severity string, sarifSeverity bool) (parsed Severity, err er

func ParseForDetails(severity string, sarifSeverity bool, applicabilityStatus jasutils.ApplicabilityStatus) (details *SeverityDetails, err error) {
if applicabilityStatus == jasutils.NotScanned {
err = errorutils.CheckError(errors.New("only the following severities are supported: " + coreutils.ListToText(supportedApplicabilityStatuses())))
err = errorutils.CheckErrorf("only the following severities are supported: %s", coreutils.ListToText(supportedApplicabilityStatuses()))
return
}
parsed, err := ParseSeverity(severity, sarifSeverity)
Expand Down

0 comments on commit c9af8da

Please sign in to comment.