Skip to content

Commit

Permalink
🌱 Bump github.com/golangci/golangci-lint from 1.40.1 to 1.41.1 (#627)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
4 people committed Jun 29, 2021
1 parent 6a3337d commit 5dd7f11
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 64 deletions.
9 changes: 5 additions & 4 deletions checks/ci_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ type ciSystemState int

const (
// CheckCITests is the registered name for CITests.
CheckCITests = "CI-Tests"
success = "success"
unknown ciSystemState = iota
CheckCITests = "CI-Tests"
success = "success"
ciSuccessPassThreshold = .75
unknown ciSystemState = iota
githubStatuses
githubCheckRuns
)
Expand Down Expand Up @@ -92,7 +93,7 @@ func CITests(c *checker.CheckRequest) checker.CheckResult {
}

c.Logf("found CI tests for %d of %d merged PRs", totalTested, totalMerged)
return checker.MakeProportionalResult(CheckCITests, totalTested, totalMerged, .75)
return checker.MakeProportionalResult(CheckCITests, totalTested, totalMerged, ciSuccessPassThreshold)
}

// PR has a status marked 'success' and a CI-related context.
Expand Down
13 changes: 8 additions & 5 deletions checks/code_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ import (
"github.com/ossf/scorecard/checker"
)

// CheckCodeReview is the registered name for DoesCodeReview.
const CheckCodeReview = "Code-Review"
const (
// CheckCodeReview is the registered name for DoesCodeReview.
CheckCodeReview = "Code-Review"
crPassThreshold = .75
)

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

func IsPrReviewRequired(c *checker.CheckRequest) checker.CheckResult {
Expand Down Expand Up @@ -155,7 +158,7 @@ func ProwCodeReview(c *checker.CheckRequest) checker.CheckResult {
return checker.MakeInconclusiveResult(CheckCodeReview, ErrorNoReviews)
}
c.Logf("prow code reviews found")
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, totalMerged, .75)
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, totalMerged, crPassThreshold)
}

func CommitMessageHints(c *checker.CheckRequest) checker.CheckResult {
Expand Down Expand Up @@ -195,5 +198,5 @@ func CommitMessageHints(c *checker.CheckRequest) checker.CheckResult {
return checker.MakeInconclusiveResult(CheckCodeReview, ErrorNoReviews)
}
c.Logf("code reviews found")
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, total, .75)
return checker.MakeProportionalResult(CheckCodeReview, totalReviewed, total, crPassThreshold)
}
4 changes: 2 additions & 2 deletions checks/frozen_deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var ErrEmptyFile = errors.New("file has no content")
// We only declare the fields we need.
// Github workflows format: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
type gitHubActionWorkflowConfig struct {
// nolinter
// nolint: govet
Jobs map[string]struct {
Name string `yaml:"name"`
Steps []struct {
Expand Down Expand Up @@ -102,7 +102,7 @@ func validateDockerfileDownloads(pathfn string, content []byte,
return false, fmt.Errorf("cannot read dockerfile content: %w", err)
}

// nolinter:prealloc
// nolint: prealloc
var bytes []byte

// Walk the Dockerfile's AST.
Expand Down
9 changes: 6 additions & 3 deletions checks/pull_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ import (
"github.com/ossf/scorecard/checker"
)

// CheckPullRequests is the registered name for PullRequests.
const CheckPullRequests = "Pull-Requests"
const (
// CheckPullRequests is the registered name for PullRequests.
CheckPullRequests = "Pull-Requests"
pullRequestsPassThreshold = .75
)

//nolint:gochecknoinits
func init() {
Expand Down Expand Up @@ -75,5 +78,5 @@ func PullRequests(c *checker.CheckRequest) checker.CheckResult {
}
}
c.Logf("found PRs for %d out of %d commits", totalWithPrs, total)
return checker.MakeProportionalResult(CheckPullRequests, totalWithPrs, total, .75)
return checker.MakeProportionalResult(CheckPullRequests, totalWithPrs, total, pullRequestsPassThreshold)
}
9 changes: 6 additions & 3 deletions checks/sast.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ import (
"github.com/ossf/scorecard/checker"
)

// CheckSAST is the registered name for SAST.
const CheckSAST = "SAST"
const (
// CheckSAST is the registered name for SAST.
CheckSAST = "SAST"
sastPassThreshold = .75
)

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

func CodeQLInCheckDefinitions(c *checker.CheckRequest) checker.CheckResult {
Expand Down
4 changes: 2 additions & 2 deletions checks/shell_download_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func isGoUnpinnedDownload(cmd []string) bool {

// `Go install` will automatically look up the
// go.mod and go.sum, so we don't flag it.
// nolinter
// nolint: gomnd
if len(cmd) <= 2 {
return false
}
Expand All @@ -361,7 +361,7 @@ func isGoUnpinnedDownload(cmd []string) bool {
pkg := cmd[i+1]
// Verify pkg = name@hash
parts := strings.Split(pkg, "@")
// nolinter
// nolint: gomnd
if len(parts) != 2 {
continue
}
Expand Down
7 changes: 4 additions & 3 deletions checks/signed_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ import (

const (
// CheckSignedReleases is the registered name for SignedReleases.
CheckSignedReleases = "Signed-Releases"
releaseLookBackDays = 5
CheckSignedReleases = "Signed-Releases"
releaseLookBackDays = 5
signedReleasesPassThreshold = .8
)

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

c.Logf("found signed artifacts for %d out of %d releases", totalSigned, totalReleases)
return checker.MakeProportionalResult(CheckSignedReleases, totalSigned, totalReleases, 0.8)
return checker.MakeProportionalResult(CheckSignedReleases, totalSigned, totalReleases, signedReleasesPassThreshold)
}
7 changes: 4 additions & 3 deletions checks/signed_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import (

const (
// CheckSignedTags is the registered name for SignedTags.
CheckSignedTags = "Signed-Tags"
tagLookBack = 5
CheckSignedTags = "Signed-Tags"
tagLookBack = 5
signedTagsPassThreshold = .8
)

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

c.Logf("found %d out of %d verified tags", totalSigned, totalTags)
return checker.MakeProportionalResult(CheckSignedTags, totalSigned, totalTags, 0.8)
return checker.MakeProportionalResult(CheckSignedTags, totalSigned, totalTags, signedTagsPassThreshold)
}
1 change: 1 addition & 0 deletions clients/githubrepo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (client *Client) InitRepo(owner, repoName string) error {
}

func (client *Client) GetRepoArchiveReader() (io.ReadCloser, error) {
// nolint: gomnd
archiveReader, err := os.OpenFile(client.tarball, os.O_RDONLY, 0o644)
if err != nil {
return archiveReader, fmt.Errorf("os.OpenFile: %w", err)
Expand Down
1 change: 1 addition & 0 deletions cron/data/add/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func main() {
if err := data.SortAndAppendTo(&buf, repoURLs, nil); err != nil {
panic(err)
}
// nolint: gomnd
projects, err := os.OpenFile(os.Args[1], os.O_WRONLY|os.O_CREATE, 0o644)
if err != nil {
panic(err)
Expand Down
1 change: 1 addition & 0 deletions cron/data/update/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func main() {
panic(err)
}

// nolint: gomnd
projects, err := os.OpenFile(os.Args[1], os.O_WRONLY, 0o644)
if err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
contrib.go.opencensus.io/exporter/stackdriver v0.13.8
github.com/bradleyfalzon/ghinstallation v1.1.1
github.com/go-git/go-git/v5 v5.4.2
github.com/golangci/golangci-lint v1.40.1
github.com/golangci/golangci-lint v1.41.1
github.com/google/addlicense v0.0.0-20210428195630-6d92264d7170
github.com/google/go-cmp v0.5.6
github.com/google/go-github/v32 v32.1.0
Expand Down

0 comments on commit 5dd7f11

Please sign in to comment.