Skip to content

Commit

Permalink
🌱 Bump github.com/golangci/golangci-lint from 1.59.1 to 1.60.1 in /to…
Browse files Browse the repository at this point in the history
…ols (#4301)
  • Loading branch information
dependabot[bot] committed Aug 14, 2024
1 parent 07ff61e commit d8ba426
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 107 deletions.
12 changes: 6 additions & 6 deletions checks/evaluation/branch_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,33 +371,33 @@ func computeFinalScore(scores []levelScore) (int, error) {
return int(score), nil
}

func info(dl checker.DetailLogger, doLogging bool, desc string, args ...interface{}) {
func info(dl checker.DetailLogger, doLogging bool, msg string) {
if !doLogging {
return
}

dl.Info(&checker.LogMessage{
Text: fmt.Sprintf(desc, args...),
Text: msg,
})
}

func debug(dl checker.DetailLogger, doLogging bool, desc string, args ...interface{}) {
func debug(dl checker.DetailLogger, doLogging bool, msg string) {
if !doLogging {
return
}

dl.Debug(&checker.LogMessage{
Text: fmt.Sprintf(desc, args...),
Text: msg,
})
}

func warn(dl checker.DetailLogger, doLogging bool, desc string, args ...interface{}) {
func warn(dl checker.DetailLogger, doLogging bool, msg string) {
if !doLogging {
return
}

dl.Warn(&checker.LogMessage{
Text: fmt.Sprintf(desc, args...),
Text: msg,
})
}

Expand Down
4 changes: 2 additions & 2 deletions checks/raw/dangerous_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ func TestGithubDangerousWorkflow(t *testing.T) {
dw, err := DangerousWorkflow(req)

if !errCmp(err, tt.expected.err) {
t.Errorf(cmp.Diff(err, tt.expected.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.expected.err, cmpopts.EquateErrors()))
}
if tt.expected.err != nil {
return
}

nb := len(dw.Workflows)
if nb != tt.expected.nb {
t.Errorf(cmp.Diff(nb, tt.expected.nb))
t.Error(cmp.Diff(nb, tt.expected.nb))
}
})
}
Expand Down
22 changes: 11 additions & 11 deletions checks/raw/pinned_dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestGithubWorkflowPinning(t *testing.T) {

_, err = validateGitHubActionWorkflow(p, content, &r)
if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down Expand Up @@ -251,7 +251,7 @@ func TestNonGithubWorkflowPinning(t *testing.T) {

_, err = validateGitHubActionWorkflow(p, content, &r)
if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down Expand Up @@ -307,7 +307,7 @@ func TestGithubWorkflowPkgManagerPinning(t *testing.T) {

_, err = validateGitHubWorkflowIsFreeOfInsecureDownloads(p, content, &r)
if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down Expand Up @@ -400,7 +400,7 @@ func TestDockerfilePinning(t *testing.T) {
var r checker.PinningDependenciesData
_, err = validateDockerfilesPinning(filepath.Join("testdata", tt.filename), content, &r)
if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down Expand Up @@ -727,7 +727,7 @@ func TestDockerfileInsecureDownloadsBrokenCommands(t *testing.T) {
var r checker.PinningDependenciesData
_, err = validateDockerfileInsecureDownloads(tt.filename, content, &r)
if !strings.Contains(err.Error(), tt.err.Error()) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}
})
}
Expand Down Expand Up @@ -1329,7 +1329,7 @@ func TestDockerfilePinningWithoutHash(t *testing.T) {
var r checker.PinningDependenciesData
_, err = validateDockerfilesPinning(tt.filename, content, &r)
if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down Expand Up @@ -1441,7 +1441,7 @@ func TestDockerfileScriptDownload(t *testing.T) {
var r checker.PinningDependenciesData
_, err = validateDockerfileInsecureDownloads(tt.filename, content, &r)
if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down Expand Up @@ -1495,7 +1495,7 @@ func TestDockerfileScriptDownloadInfo(t *testing.T) {
var r checker.PinningDependenciesData
_, err = validateDockerfileInsecureDownloads(tt.filename, content, &r)
if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down Expand Up @@ -1578,7 +1578,7 @@ func TestShellScriptDownload(t *testing.T) {
_, err = validateShellScriptIsFreeOfInsecureDownloads(tt.filename, content, &r)

if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down Expand Up @@ -1632,7 +1632,7 @@ func TestShellScriptDownloadPinned(t *testing.T) {
_, err = validateShellScriptIsFreeOfInsecureDownloads(tt.filename, content, &r)

if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down Expand Up @@ -1700,7 +1700,7 @@ func TestGitHubWorkflowRunDownload(t *testing.T) {

_, err = validateGitHubWorkflowIsFreeOfInsecureDownloads(p, content, &r)
if !errCmp(err, tt.err) {
t.Errorf(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
t.Error(cmp.Diff(err, tt.err, cmpopts.EquateErrors()))
}

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cron/internal/format/json_raw_results.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func addDependencyUpdateToolRawResults(r *jsonScorecardRawResult,
URL: t.URL,
Desc: t.Desc,
}
if t.Files != nil && len(t.Files) > 0 {
if len(t.Files) > 0 {
for _, f := range t.Files {
jt.Files = append(jt.Files, jsonFile{
Path: f.Path,
Expand Down
4 changes: 2 additions & 2 deletions cron/internal/format/schema_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func Test_GenerateBQSchema(t *testing.T) {
}

if !cmp.Equal(result, expected.String()) {
t.Errorf(cmp.Diff(result, expected.String()))
t.Error(cmp.Diff(result, expected.String()))
}
})
}
Expand Down Expand Up @@ -129,7 +129,7 @@ func Test_GenerateJSONSchema(t *testing.T) {
result := GenerateJSONSchema(tt.structure)

if !cmp.Equal(result, expected.String()) {
t.Errorf(cmp.Diff(result, expected.String()))
t.Error(cmp.Diff(result, expected.String()))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion finding/finding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func Test_FromBytes(t *testing.T) {

content, err := os.ReadFile(tt.path)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

r, err := FromBytes(content, tt.id)
Expand Down
2 changes: 1 addition & 1 deletion finding/probe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func Test_probeFromBytes(t *testing.T) {

content, err := os.ReadFile(tt.path)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}

r, err := probeFromBytes(content, tt.id)
Expand Down
2 changes: 1 addition & 1 deletion pkg/scorecard/json_raw_results_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ func TestScorecardResult_AsRawJSON(t *testing.T) {
return
}
if gotWriter := writer.String(); gotWriter != tt.wantWriter {
t.Errorf(cmp.Diff(gotWriter, tt.wantWriter))
t.Error(cmp.Diff(gotWriter, tt.wantWriter))
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions remediation/remediations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestCreateDockerfilePinningRemediation(t *testing.T) {
t.Parallel()
got := CreateDockerfilePinningRemediation(&tt.dep, stubDigester{})
if !cmp.Equal(got, tt.expected) {
t.Errorf(cmp.Diff(got, tt.expected))
t.Error(cmp.Diff(got, tt.expected))
}
})
}
Expand Down Expand Up @@ -185,7 +185,7 @@ func TestCreateWorkflowPinningRemediation(t *testing.T) {
}
got := r.CreateWorkflowPinningRemediation(tt.filepath)
if !cmp.Equal(got, tt.expected) {
t.Errorf(cmp.Diff(got, tt.expected))
t.Error(cmp.Diff(got, tt.expected))
}
})
}
Expand Down
Loading

0 comments on commit d8ba426

Please sign in to comment.