mirror of
https://github.com/ossf/scorecard.git
synced 2024-08-15 11:20:30 +03:00
🌱Fix lint issues: gochecknoinits linter (#485)
* Fix lint issues: gochecknoinits linter * Fix lint issues: gochecknoinits linter
This commit is contained in:
parent
f996065e40
commit
50f7ed8519
@ -16,7 +16,7 @@ linters:
|
||||
- errcheck
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
# - gochecknoinits
|
||||
- gochecknoinits
|
||||
- gocognit
|
||||
- goconst
|
||||
- gocritic
|
||||
|
@ -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
|
||||
|
@ -26,6 +26,7 @@ const (
|
||||
lookbackDays = 90
|
||||
)
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(activeStr, IsActive)
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ const (
|
||||
minReviews = 1
|
||||
)
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(branchProtectionStr, BranchProtection)
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ const (
|
||||
githubCheckRuns
|
||||
)
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(ciTestsStr, CITests)
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
|
||||
const ciiBestPracticesStr = "CII-Best-Practices"
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(ciiBestPracticesStr, CIIBestPractices)
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
|
||||
const codeReviewStr = "Code-Review"
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(codeReviewStr, DoesCodeReview)
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ const (
|
||||
contributorsStr = "Contributors"
|
||||
)
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(contributorsStr, Contributors)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
|
||||
const fuzzingStr = "Fuzzing"
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(fuzzingStr, Fuzzing)
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
|
||||
const packagingStr = "Packaging"
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(packagingStr, Packaging)
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
|
||||
const pullRequestsStr = "Pull-Requests"
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(pullRequestsStr, PullRequests)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
|
||||
const securityPolicyStr = "Security-Policy"
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(securityPolicyStr, SecurityPolicy)
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ const (
|
||||
releaseLookBackDays = 5
|
||||
)
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(signedReleasesStr, SignedReleases)
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ const (
|
||||
tagLookBack = 5
|
||||
)
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
registerCheck(signedTagsStr, SignedTags)
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -32,6 +32,7 @@ import (
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
//nolint:gochecknoinits
|
||||
func init() {
|
||||
rootCmd.AddCommand(serveCmd)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user