🌱Fix lint issues: gochecknoinits linter (#485)

* Fix lint issues: gochecknoinits linter

* Fix lint issues: gochecknoinits linter
This commit is contained in:
Chris McGehee 2021-05-22 10:19:52 -07:00 committed by GitHub
parent f996065e40
commit 50f7ed8519
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 23 additions and 5 deletions

View File

@ -16,7 +16,7 @@ linters:
- errcheck
- exhaustive
- exportloopref
# - gochecknoinits
- gochecknoinits
- gocognit
- goconst
- gocritic

View File

@ -149,10 +149,12 @@ type CheckFn func(*c.Checker) CheckResult
Checks are registered in an init function:
```golang
AllChecks = append(AllChecks, NamedCheck{
Name: "Code-Review",
Fn: DoesCodeReview,
})
const codeReviewStr = "Code-Review"
//nolint:gochecknoinits
func init() {
registerCheck(codeReviewStr, DoesCodeReview)
}
```
### Updating Docs

View File

@ -26,6 +26,7 @@ const (
lookbackDays = 90
)
//nolint:gochecknoinits
func init() {
registerCheck(activeStr, IsActive)
}

View File

@ -24,6 +24,7 @@ const (
minReviews = 1
)
//nolint:gochecknoinits
func init() {
registerCheck(branchProtectionStr, BranchProtection)
}

View File

@ -36,6 +36,7 @@ const (
githubCheckRuns
)
//nolint:gochecknoinits
func init() {
registerCheck(ciTestsStr, CITests)
}

View File

@ -25,6 +25,7 @@ import (
const ciiBestPracticesStr = "CII-Best-Practices"
//nolint:gochecknoinits
func init() {
registerCheck(ciiBestPracticesStr, CIIBestPractices)
}

View File

@ -24,6 +24,7 @@ import (
const codeReviewStr = "Code-Review"
//nolint:gochecknoinits
func init() {
registerCheck(codeReviewStr, DoesCodeReview)
}

View File

@ -27,6 +27,7 @@ const (
contributorsStr = "Contributors"
)
//nolint:gochecknoinits
func init() {
registerCheck(contributorsStr, Contributors)
}

View File

@ -33,6 +33,7 @@ var ErrInvalidDockerfile = errors.New("invalid docker file")
// ErrEmptyFile : Invalid docker file.
var ErrEmptyFile = errors.New("file has no content")
//nolint:gochecknoinits
func init() {
registerCheck(frozenDepsStr, FrozenDeps)
}

View File

@ -23,6 +23,7 @@ import (
const fuzzingStr = "Fuzzing"
//nolint:gochecknoinits
func init() {
registerCheck(fuzzingStr, Fuzzing)
}

View File

@ -25,6 +25,7 @@ import (
const packagingStr = "Packaging"
//nolint:gochecknoinits
func init() {
registerCheck(packagingStr, Packaging)
}

View File

@ -23,6 +23,7 @@ import (
const pullRequestsStr = "Pull-Requests"
//nolint:gochecknoinits
func init() {
registerCheck(pullRequestsStr, PullRequests)
}

View File

@ -25,6 +25,7 @@ const sastStr = "SAST"
var sastTools map[string]bool = map[string]bool{"github-code-scanning": true, "sonarcloud": true}
//nolint:gochecknoinits
func init() {
registerCheck(sastStr, SAST)
}

View File

@ -22,6 +22,7 @@ import (
const securityPolicyStr = "Security-Policy"
//nolint:gochecknoinits
func init() {
registerCheck(securityPolicyStr, SecurityPolicy)
}

View File

@ -27,6 +27,7 @@ const (
releaseLookBackDays = 5
)
//nolint:gochecknoinits
func init() {
registerCheck(signedReleasesStr, SignedReleases)
}

View File

@ -26,6 +26,7 @@ const (
tagLookBack = 5
)
//nolint:gochecknoinits
func init() {
registerCheck(signedTagsStr, SignedTags)
}

View File

@ -267,6 +267,7 @@ func fetchGitRepositoryFromRubyGems(packageName string) (string, error) {
return v.SourceCodeURI, nil
}
//nolint:gochecknoinits
func init() {
// Add the zap flag manually
rootCmd.PersistentFlags().AddGoFlagSet(goflag.CommandLine)

View File

@ -32,6 +32,7 @@ import (
"go.uber.org/zap"
)
//nolint:gochecknoinits
func init() {
rootCmd.AddCommand(serveCmd)
}