Skip to content

Commit 5dd7f11

Browse files
dependabot[bot]azeemsgoogleazeemshaikh38naveensrinivasan
authored
🌱 Bump github.com/golangci/golangci-lint from 1.40.1 to 1.41.1 (#627)
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.40.1 to 1.41.1. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](golangci/golangci-lint@v1.40.1...v1.41.1) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Azeem Shaikh <azeems@google.com> Co-authored-by: Azeem Shaikh <azeemshaikh38@gmail.com> Co-authored-by: Naveen <172697+naveensrinivasan@users.noreply.github.com>
1 parent 6a3337d commit 5dd7f11

File tree

13 files changed

+78
-64
lines changed

13 files changed

+78
-64
lines changed

checks/ci_tests.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ type ciSystemState int
2828

2929
const (
3030
// CheckCITests is the registered name for CITests.
31-
CheckCITests = "CI-Tests"
32-
success = "success"
33-
unknown ciSystemState = iota
31+
CheckCITests = "CI-Tests"
32+
success = "success"
33+
ciSuccessPassThreshold = .75
34+
unknown ciSystemState = iota
3435
githubStatuses
3536
githubCheckRuns
3637
)
@@ -92,7 +93,7 @@ func CITests(c *checker.CheckRequest) checker.CheckResult {
9293
}
9394

9495
c.Logf("found CI tests for %d of %d merged PRs", totalTested, totalMerged)
95-
return checker.MakeProportionalResult(CheckCITests, totalTested, totalMerged, .75)
96+
return checker.MakeProportionalResult(CheckCITests, totalTested, totalMerged, ciSuccessPassThreshold)
9697
}
9798

9899
// PR has a status marked 'success' and a CI-related context.

checks/code_review.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ import (
2323
"github.com/ossf/scorecard/checker"
2424
)
2525

26-
// CheckCodeReview is the registered name for DoesCodeReview.
27-
const CheckCodeReview = "Code-Review"
26+
const (
27+
// CheckCodeReview is the registered name for DoesCodeReview.
28+
CheckCodeReview = "Code-Review"
29+
crPassThreshold = .75
30+
)
2831

2932
// ErrorNoReviews indicates no reviews were found for this repo.
3033
var ErrorNoReviews = errors.New("no reviews found")
@@ -99,7 +102,7 @@ func GithubCodeReview(c *checker.CheckRequest) checker.CheckResult {
99102
if totalReviewed > 0 {
100103
c.Logf("github code reviews found")
101104
}
102-
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, totalMerged, .75)
105+
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, totalMerged, crPassThreshold)
103106
}
104107

105108
func IsPrReviewRequired(c *checker.CheckRequest) checker.CheckResult {
@@ -155,7 +158,7 @@ func ProwCodeReview(c *checker.CheckRequest) checker.CheckResult {
155158
return checker.MakeInconclusiveResult(CheckCodeReview, ErrorNoReviews)
156159
}
157160
c.Logf("prow code reviews found")
158-
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, totalMerged, .75)
161+
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, totalMerged, crPassThreshold)
159162
}
160163

161164
func CommitMessageHints(c *checker.CheckRequest) checker.CheckResult {
@@ -195,5 +198,5 @@ func CommitMessageHints(c *checker.CheckRequest) checker.CheckResult {
195198
return checker.MakeInconclusiveResult(CheckCodeReview, ErrorNoReviews)
196199
}
197200
c.Logf("code reviews found")
198-
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, total, .75)
201+
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, total, crPassThreshold)
199202
}

checks/frozen_deps.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var ErrEmptyFile = errors.New("file has no content")
3939
// We only declare the fields we need.
4040
// Github workflows format: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
4141
type gitHubActionWorkflowConfig struct {
42-
// nolinter
42+
// nolint: govet
4343
Jobs map[string]struct {
4444
Name string `yaml:"name"`
4545
Steps []struct {
@@ -102,7 +102,7 @@ func validateDockerfileDownloads(pathfn string, content []byte,
102102
return false, fmt.Errorf("cannot read dockerfile content: %w", err)
103103
}
104104

105-
// nolinter:prealloc
105+
// nolint: prealloc
106106
var bytes []byte
107107

108108
// Walk the Dockerfile's AST.

checks/pull_requests.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ import (
2222
"github.com/ossf/scorecard/checker"
2323
)
2424

25-
// CheckPullRequests is the registered name for PullRequests.
26-
const CheckPullRequests = "Pull-Requests"
25+
const (
26+
// CheckPullRequests is the registered name for PullRequests.
27+
CheckPullRequests = "Pull-Requests"
28+
pullRequestsPassThreshold = .75
29+
)
2730

2831
//nolint:gochecknoinits
2932
func init() {
@@ -75,5 +78,5 @@ func PullRequests(c *checker.CheckRequest) checker.CheckResult {
7578
}
7679
}
7780
c.Logf("found PRs for %d out of %d commits", totalWithPrs, total)
78-
return checker.MakeProportionalResult(CheckPullRequests, totalWithPrs, total, .75)
81+
return checker.MakeProportionalResult(CheckPullRequests, totalWithPrs, total, pullRequestsPassThreshold)
7982
}

checks/sast.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ import (
2222
"github.com/ossf/scorecard/checker"
2323
)
2424

25-
// CheckSAST is the registered name for SAST.
26-
const CheckSAST = "SAST"
25+
const (
26+
// CheckSAST is the registered name for SAST.
27+
CheckSAST = "SAST"
28+
sastPassThreshold = .75
29+
)
2730

2831
var (
2932
sastTools = map[string]bool{"github-code-scanning": true, "sonarcloud": true}
@@ -85,7 +88,7 @@ func SASTToolInCheckRuns(c *checker.CheckRequest) checker.CheckResult {
8588
if totalTested == 0 {
8689
return checker.MakeInconclusiveResult(CheckSAST, ErrorNoMerges)
8790
}
88-
return checker.MakeProportionalResult(CheckSAST, totalTested, totalMerged, .75)
91+
return checker.MakeProportionalResult(CheckSAST, totalTested, totalMerged, sastPassThreshold)
8992
}
9093

9194
func CodeQLInCheckDefinitions(c *checker.CheckRequest) checker.CheckResult {

checks/shell_download_validate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func isGoUnpinnedDownload(cmd []string) bool {
340340

341341
// `Go install` will automatically look up the
342342
// go.mod and go.sum, so we don't flag it.
343-
// nolinter
343+
// nolint: gomnd
344344
if len(cmd) <= 2 {
345345
return false
346346
}
@@ -361,7 +361,7 @@ func isGoUnpinnedDownload(cmd []string) bool {
361361
pkg := cmd[i+1]
362362
// Verify pkg = name@hash
363363
parts := strings.Split(pkg, "@")
364-
// nolinter
364+
// nolint: gomnd
365365
if len(parts) != 2 {
366366
continue
367367
}

checks/signed_releases.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ import (
2525

2626
const (
2727
// CheckSignedReleases is the registered name for SignedReleases.
28-
CheckSignedReleases = "Signed-Releases"
29-
releaseLookBackDays = 5
28+
CheckSignedReleases = "Signed-Releases"
29+
releaseLookBackDays = 5
30+
signedReleasesPassThreshold = .8
3031
)
3132

3233
// ErrorNoReleases indicates no releases were found for this repo.
@@ -85,5 +86,5 @@ func SignedReleases(c *checker.CheckRequest) checker.CheckResult {
8586
}
8687

8788
c.Logf("found signed artifacts for %d out of %d releases", totalSigned, totalReleases)
88-
return checker.MakeProportionalResult(CheckSignedReleases, totalSigned, totalReleases, 0.8)
89+
return checker.MakeProportionalResult(CheckSignedReleases, totalSigned, totalReleases, signedReleasesPassThreshold)
8990
}

checks/signed_tags.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ import (
2424

2525
const (
2626
// CheckSignedTags is the registered name for SignedTags.
27-
CheckSignedTags = "Signed-Tags"
28-
tagLookBack = 5
27+
CheckSignedTags = "Signed-Tags"
28+
tagLookBack = 5
29+
signedTagsPassThreshold = .8
2930
)
3031

3132
// ErrorNoTags indicates no tags were found for this repo.
@@ -84,5 +85,5 @@ func SignedTags(c *checker.CheckRequest) checker.CheckResult {
8485
}
8586

8687
c.Logf("found %d out of %d verified tags", totalSigned, totalTags)
87-
return checker.MakeProportionalResult(CheckSignedTags, totalSigned, totalTags, 0.8)
88+
return checker.MakeProportionalResult(CheckSignedTags, totalSigned, totalTags, signedTagsPassThreshold)
8889
}

clients/githubrepo/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func (client *Client) InitRepo(owner, repoName string) error {
8787
}
8888

8989
func (client *Client) GetRepoArchiveReader() (io.ReadCloser, error) {
90+
// nolint: gomnd
9091
archiveReader, err := os.OpenFile(client.tarball, os.O_RDONLY, 0o644)
9192
if err != nil {
9293
return archiveReader, fmt.Errorf("os.OpenFile: %w", err)

cron/data/add/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func main() {
4545
if err := data.SortAndAppendTo(&buf, repoURLs, nil); err != nil {
4646
panic(err)
4747
}
48+
// nolint: gomnd
4849
projects, err := os.OpenFile(os.Args[1], os.O_WRONLY|os.O_CREATE, 0o644)
4950
if err != nil {
5051
panic(err)

0 commit comments

Comments
 (0)