istio.io/common/config/.golangci.yml

222 lines
5.0 KiB
YAML

version: "2"
run:
build-tags:
- integ
- integfuzz
linters:
default: none
enable:
- copyloopvar
- depguard
- errcheck
- gocritic
- gosec
- govet
- ineffassign
- lll
- misspell
- revive
- staticcheck
- unconvert
- unparam
- unused
settings:
depguard:
rules:
DenyGogoProtobuf:
files:
- $all
deny:
- pkg: github.com/gogo/protobuf
desc: gogo/protobuf is deprecated, use golang/protobuf
errcheck:
check-type-assertions: false
check-blank: false
gocritic:
disable-all: true
enabled-checks:
- appendCombine
- argOrder
- assignOp
- badCond
- boolExprSimplify
- builtinShadow
- captLocal
- caseOrder
- codegenComment
- commentedOutCode
- commentedOutImport
- defaultCaseOrder
- deprecatedComment
- docStub
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- elseif
- emptyFallthrough
- equalFold
- flagDeref
- flagName
- hexLiteral
- indexAlloc
- initClause
- methodExprCall
- nilValReturn
- octalLiteral
- offBy1
- rangeExprCopy
- regexpMust
- sloppyLen
- stringXbytes
- switchTrue
- typeAssertChain
- typeSwitchVar
- typeUnparen
- underef
- unlambda
- unnecessaryBlock
- unslice
- valSwap
- weakCond
gosec:
includes:
- G401
- G402
- G404
govet:
disable:
- shadow
lll:
line-length: 160
tab-width: 1
misspell:
locale: US
ignore-rules:
- cancelled
revive:
confidence: 0
severity: warning
rules:
- name: blank-imports
- name: context-keys-type
- name: time-naming
- name: var-declaration
- name: unexported-return
- name: errorf
- name: context-as-argument
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: increment-decrement
- name: var-naming
- name: package-comments
- name: range
- name: receiver-naming
- name: indent-error-flow
- name: superfluous-else
- name: modifies-parameter
- name: unreachable-code
- name: struct-tag
- name: constant-logical-expr
- name: bool-literal-in-expr
- name: redefines-builtin-id
- name: imports-blocklist
- name: range-val-in-closure
- name: range-val-address
- name: waitgroup-by-value
- name: atomic
- name: call-to-gc
- name: duplicated-imports
- name: string-of-int
- name: defer
arguments:
- - call-chain
- name: unconditional-recursion
- name: identical-branches
unparam:
check-exported: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- errcheck
- maligned
path: _test\.go$|tests/|samples/
- path: _test\.go$
text: 'dot-imports: should not use dot imports'
- linters:
- staticcheck
text: 'SA1019: package github.com/golang/protobuf/jsonpb'
- linters:
- staticcheck
text: 'SA1019: "github.com/golang/protobuf/jsonpb"'
- linters:
- staticcheck
text: 'SA1019: grpc.Dial is deprecated: use NewClient instead'
- linters:
- staticcheck
text: 'SA1019: grpc.DialContext is deprecated: use NewClient instead'
- linters:
- staticcheck
text: 'SA1019: grpc.WithBlock is deprecated'
- linters:
- staticcheck
text: 'SA1019: grpc.FailOnNonTempDialError'
- linters:
- staticcheck
text: 'SA1019: grpc.WithReturnConnectionError'
- path: (.+)\.go$
text: composite literal uses unkeyed fields
# TODO: remove following rule in the future
- linters:
- staticcheck
text: 'QF'
- linters:
- staticcheck
text: 'ST1005'
- linters:
- staticcheck
text: 'S1007'
paths:
- .*\.pb\.go
- .*\.gen\.go
- genfiles$
- vendor$
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
- gofumpt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(istio.io/)
goimports:
local-prefixes:
- istio.io/
exclusions:
generated: lax
paths:
- .*\.pb\.go
- .*\.gen\.go
- genfiles$
- vendor$
- third_party$
- builtin$
- examples$