188 lines
5.9 KiB
YAML
188 lines
5.9 KiB
YAML
version: "2"
|
||
run:
|
||
timeout: 7m
|
||
linters:
|
||
enable:
|
||
- gocritic
|
||
- revive
|
||
- gocyclo
|
||
- misspell
|
||
- nakedret
|
||
- staticcheck
|
||
- unconvert
|
||
- unparam
|
||
- dogsled
|
||
settings:
|
||
staticcheck:
|
||
checks:
|
||
# Below is the default set
|
||
- "all"
|
||
- "-ST1000"
|
||
- "-ST1003"
|
||
- "-ST1016"
|
||
- "-ST1020"
|
||
- "-ST1021"
|
||
- "-ST1022"
|
||
##### TODO: fix and enable these
|
||
# 4 occurrences.
|
||
# Use fmt.Fprintf(x, ...) instead of x.Write(fmt.Sprintf(...)) https://staticcheck.dev/docs/checks#QF1012
|
||
- "-QF1012"
|
||
# 3 occurrences.
|
||
# Apply De Morgan’s law https://staticcheck.dev/docs/checks#QF1001
|
||
- "-QF1001"
|
||
# 9 occurrences.
|
||
# Convert if/else-if chain to tagged switch https://staticcheck.dev/docs/checks#QF1003
|
||
- "-QF1003"
|
||
# 1 occurrence.
|
||
# could omit type *os.File from declaration; it will be inferred from the right-hand side
|
||
- "-QF1011"
|
||
##### These have been vetted to be disabled.
|
||
# 19 occurrences. Omit embedded fields from selector expression https://staticcheck.dev/docs/checks#QF1008
|
||
# Usefulness is questionable.
|
||
- "-QF1008"
|
||
revive:
|
||
enable-all-rules: true
|
||
rules:
|
||
# See https://revive.run/r
|
||
|
||
##### P0: we should do it ASAP.
|
||
- name: max-control-nesting
|
||
arguments: [7]
|
||
- name: deep-exit
|
||
disabled: true
|
||
- name: unchecked-type-assertion
|
||
disabled: true
|
||
- name: bare-return
|
||
disabled: true
|
||
- name: import-shadowing
|
||
disabled: true
|
||
- name: use-errors-new
|
||
disabled: true
|
||
##### P1: consider making a dent on these, but not critical.
|
||
- name: argument-limit
|
||
arguments: [12]
|
||
- name: unnecessary-stmt
|
||
disabled: true
|
||
- name: defer
|
||
disabled: true
|
||
- name: confusing-naming
|
||
disabled: true
|
||
- name: early-return
|
||
disabled: true
|
||
- name: function-result-limit
|
||
arguments: [7]
|
||
- name: function-length
|
||
arguments: [0, 400]
|
||
- name: cyclomatic
|
||
arguments: [100]
|
||
- name: unhandled-error
|
||
disabled: true
|
||
- name: cognitive-complexity
|
||
arguments: [197]
|
||
##### P2: nice to have.
|
||
- name: max-public-structs
|
||
arguments: [25]
|
||
- name: confusing-results
|
||
disabled: true
|
||
- name: comment-spacings
|
||
disabled: true
|
||
- name: use-any
|
||
disabled: true
|
||
- name: empty-lines
|
||
disabled: true
|
||
- name: package-comments
|
||
disabled: true
|
||
- name: exported
|
||
disabled: true
|
||
###### Permanently disabled. Below have been reviewed and vetted to be unnecessary.
|
||
- name: line-length-limit
|
||
disabled: true
|
||
- name: nested-structs
|
||
disabled: true
|
||
- name: flag-parameter
|
||
disabled: true
|
||
- name: unused-parameter
|
||
disabled: true
|
||
- name: unused-receiver
|
||
disabled: true
|
||
- name: add-constant
|
||
disabled: true
|
||
###### To be determined, this is a rule with differences.
|
||
- name: import-alias-naming
|
||
disabled: true
|
||
- name: unexported-naming
|
||
disabled: true
|
||
- name: struct-tag
|
||
disabled: true
|
||
- name: redundant-import-alias
|
||
disabled: true
|
||
gocritic:
|
||
# See https://go-critic.com/overview.html
|
||
disabled-checks:
|
||
# Below are normally enabled by default, but we do not pass
|
||
- appendAssign
|
||
- ifElseChain
|
||
- unslice
|
||
- badCall
|
||
- assignOp
|
||
- commentFormatting
|
||
- captLocal
|
||
- singleCaseSwitch
|
||
- wrapperFunc
|
||
- elseif
|
||
- regexpMust
|
||
- deprecatedComment
|
||
enabled-checks:
|
||
# Below used to be enabled, but we do not pass anymore
|
||
# - paramTypeCombine
|
||
# - octalLiteral
|
||
# - unnamedResult
|
||
# - equalFold
|
||
# - sloppyReassign
|
||
# - emptyStringTest
|
||
# - hugeParam
|
||
# - appendCombine
|
||
# - stringXbytes
|
||
# - ptrToRefParam
|
||
# - commentedOutCode
|
||
# - rangeValCopy
|
||
# - methodExprCall
|
||
# - yodaStyleExpr
|
||
# - typeUnparen
|
||
|
||
##### TODO: fix and enable these
|
||
# We enabled these and we pass
|
||
- nilValReturn
|
||
# - weakCond # pkg/minikube/config/profile.go:61:9: weakCond: suspicious `cc.Nodes != nil && cc.Nodes[0].Name == node.Name`; nil check may not be enough, check for len (gocritic)
|
||
- indexAlloc
|
||
- rangeExprCopy
|
||
- boolExprSimplify
|
||
- commentedOutImport
|
||
# - docStub # pkg/minikube/tunnel/kic/service_tunnel.go:51:1: docStub: silencing go lint doc-comment warnings is unadvised (gocritic)
|
||
- emptyFallthrough
|
||
- hexLiteral
|
||
- typeAssertChain
|
||
- unlabelStmt
|
||
# - builtinShadow # cmd/minikube/cmd/delete.go:89:7: builtinShadow: shadowing of predeclared identifier: error (gocritic)
|
||
# - importShadow # pkg/storage/storage_provisioner.go:60:2: importShadow: shadow of imported package 'path' (gocritic)
|
||
- initClause
|
||
# - nestingReduce # pkg/minikube/tunnel/registry.go:94:3: nestingReduce: invert if cond, replace body with `continue`, move old body after the statement (gocritic)
|
||
- unnecessaryBlock
|
||
|
||
exclusions:
|
||
paths:
|
||
# we generally dont wanna touch or lint the Third_party code, it is basically like a fork for code that we can not import.
|
||
# but have to copy/paste
|
||
- third_party
|
||
# Skip test files
|
||
- '(.+)_test\.go'
|
||
rules:
|
||
# I think this check is meaningless.
|
||
- path: '(.+)\.go$'
|
||
text: "Error return value of `.*` is not checked"
|
||
linter: errcheck
|
||
# This code is doubtful and I don't understand it. Location: Line 456
|
||
- path: 'cmd/minikube/cmd/docker-env.go'
|
||
text: "useless-break: useless break in case clause"
|
||
linter: revive
|