-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(lint): Add support for linter in mage (#2392)
- Loading branch information
Showing
115 changed files
with
1,205 additions
and
871 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,159 @@ | ||
linters-settings: | ||
depguard: | ||
rules: | ||
main: | ||
list-mode: lax | ||
deny: | ||
# Cannot use gomodguard, which examines go.mod, as "golang.org/x/exp/slices" is not a module and doesn't appear in go.mod. | ||
- pkg: "golang.org/x/exp/slices" | ||
desc: "Use 'slices' instead" | ||
- pkg: "golang.org/x/exp/maps" | ||
desc: "Use 'maps' or 'github.com/samber/lo' instead" | ||
dupl: | ||
threshold: 100 | ||
errcheck: | ||
check-type-assertions: true | ||
check-blank: true | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- prefix(github.com/aquasecurity/) | ||
- blank | ||
- dot | ||
goconst: | ||
min-len: 3 | ||
min-occurrences: 3 | ||
gocritic: | ||
disabled-checks: | ||
- appendAssign | ||
- unnamedResult | ||
- whyNoLint | ||
- indexAlloc | ||
- octalLiteral | ||
- hugeParam | ||
- rangeValCopy | ||
- regexpSimplify | ||
- sloppyReassign | ||
- commentedOutCode | ||
enabled-tags: | ||
- diagnostic | ||
- style | ||
- performance | ||
- experimental | ||
- opinionated | ||
settings: | ||
ruleguard: | ||
failOn: all | ||
rules: '${configDir}/misc/lint/rules.go' | ||
gocyclo: | ||
min-complexity: 40 | ||
gofmt: | ||
simplify: false | ||
rewrite-rules: | ||
- pattern: 'interface{}' | ||
replacement: 'any' | ||
gomodguard: | ||
blocked: | ||
modules: | ||
- github.com/hashicorp/go-version: | ||
recommendations: | ||
- github.com/aquasecurity/go-version | ||
reason: "`aquasecurity/go-version` is designed for our use-cases" | ||
- github.com/Masterminds/semver: | ||
recommendations: | ||
- github.com/aquasecurity/go-version | ||
reason: "`aquasecurity/go-version` is designed for our use-cases" | ||
gosec: | ||
excludes: | ||
- G101 | ||
- G114 | ||
- G115 | ||
- G204 | ||
- G304 | ||
- G402 | ||
govet: | ||
check-shadowing: false | ||
misspell: | ||
locale: US | ||
ignore-words: | ||
- behaviour | ||
- licence | ||
- optimise | ||
- simmilar | ||
perfsprint: | ||
# Optimizes even if it requires an int or uint type cast. | ||
int-conversion: false | ||
# Optimizes into `err.Error()` even if it is only equivalent for non-nil errors. | ||
err-error: true | ||
# Optimizes `fmt.Errorf`. | ||
errorf: true | ||
# Optimizes `fmt.Sprintf` with only one argument. | ||
sprintf1: false | ||
# Optimizes into strings concatenation. | ||
strconcat: false | ||
revive: | ||
ignore-generated-header: true | ||
testifylint: | ||
enable-all: true | ||
linters: | ||
disable: | ||
- structcheck # FIXME: Currently doesn't work on Go 1.18: https://github.com/golangci/golangci-lint/issues/2649 | ||
disable-all: true | ||
enable: | ||
- errorlint | ||
- bodyclose | ||
- depguard | ||
- gci | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- gomodguard | ||
- gosec | ||
# - unparam FIXME: Currently doesn't work on Go 1.18: https://github.com/golangci/golangci-lint/issues/2649 | ||
linters-settings: | ||
gocritic: | ||
enabled-checks: | ||
- importShadow | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- perfsprint | ||
- revive | ||
- tenv | ||
- testifylint | ||
- typecheck | ||
- unconvert | ||
- unused | ||
- usestdlibvars | ||
|
||
run: | ||
timeout: 5m | ||
go: '1.23' | ||
timeout: 30m | ||
|
||
issues: | ||
exclude-files: | ||
- "mock_*.go$" | ||
- "examples/*" | ||
exclude-dirs: | ||
- "pkg/iac/scanners/terraform/parser/funcs" # copies of Terraform functions | ||
exclude-rules: | ||
- path: ".*_test.go$" | ||
linters: | ||
- goconst | ||
- gosec | ||
- unused | ||
- path: ".*_test.go$" | ||
linters: | ||
- govet | ||
text: "copylocks:" | ||
- path: ".*_test.go$" | ||
linters: | ||
- gocritic | ||
text: "commentFormatting:" | ||
- path: ".*_test.go$" | ||
linters: | ||
- gocritic | ||
text: "exitAfterDefer:" | ||
- path: ".*_test.go$" | ||
linters: | ||
- gocritic | ||
text: "importShadow:" | ||
- linters: | ||
- perfsprint | ||
text: "fmt.Sprint" | ||
exclude-use-default: false | ||
max-same-issues: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.