2020-11-03 11:25:47 +08:00
|
|
|
run:
|
2023-10-11 21:01:35 +08:00
|
|
|
go: "1.18"
|
2020-11-03 11:25:47 +08:00
|
|
|
skip-dirs:
|
|
|
|
- build
|
|
|
|
- configs
|
|
|
|
- deployments
|
|
|
|
- docs
|
|
|
|
- scripts
|
|
|
|
- internal/core
|
2023-09-21 09:45:27 +08:00
|
|
|
- cmake_build
|
2020-11-03 11:25:47 +08:00
|
|
|
|
|
|
|
linters:
|
2020-11-04 16:28:14 +08:00
|
|
|
disable-all: true
|
2020-11-03 11:25:47 +08:00
|
|
|
enable:
|
2023-09-21 09:45:27 +08:00
|
|
|
- gosimple
|
2020-11-03 11:25:47 +08:00
|
|
|
- govet
|
|
|
|
- ineffassign
|
2023-09-21 09:45:27 +08:00
|
|
|
- staticcheck
|
|
|
|
- decorder
|
|
|
|
- depguard
|
|
|
|
- gofmt
|
|
|
|
- goimports
|
2021-09-18 14:45:50 +08:00
|
|
|
- gosec
|
2021-12-07 19:43:03 +08:00
|
|
|
- revive
|
2023-02-15 17:22:34 +08:00
|
|
|
- unconvert
|
2023-09-21 09:45:27 +08:00
|
|
|
- misspell
|
|
|
|
- typecheck
|
|
|
|
- durationcheck
|
2023-03-10 15:53:53 +08:00
|
|
|
- forbidigo
|
2023-09-21 09:45:27 +08:00
|
|
|
- gci
|
|
|
|
- whitespace
|
|
|
|
- gofumpt
|
2023-09-22 10:05:26 +08:00
|
|
|
- gocritic
|
2022-06-10 14:58:07 +08:00
|
|
|
|
|
|
|
linters-settings:
|
2023-09-21 09:45:27 +08:00
|
|
|
gci:
|
|
|
|
sections:
|
|
|
|
- standard
|
|
|
|
- default
|
|
|
|
- prefix(github.com/milvus-io)
|
|
|
|
custom-order: true
|
|
|
|
gofumpt:
|
|
|
|
lang-version: "1.18"
|
|
|
|
module-path: github.com/milvus-io
|
|
|
|
goimports:
|
|
|
|
local-prefixes: github.com/milvus-io
|
2023-06-07 19:34:36 +08:00
|
|
|
revive:
|
|
|
|
rules:
|
|
|
|
- name: unused-parameter
|
|
|
|
disabled: true
|
2023-10-07 10:09:31 +08:00
|
|
|
- name: var-naming
|
|
|
|
severity: warning
|
|
|
|
disabled: false
|
|
|
|
arguments:
|
|
|
|
- ["ID"] # Allow list
|
2023-10-07 20:53:38 +08:00
|
|
|
- name: context-as-argument
|
|
|
|
severity: warning
|
|
|
|
disabled: false
|
|
|
|
arguments:
|
|
|
|
- allowTypesBefore: "*testing.T"
|
|
|
|
- name: datarace
|
|
|
|
severity: warning
|
|
|
|
disabled: false
|
|
|
|
- name: duplicated-imports
|
|
|
|
severity: warning
|
|
|
|
disabled: false
|
|
|
|
- name: waitgroup-by-value
|
|
|
|
severity: warning
|
|
|
|
disabled: false
|
|
|
|
- name: indent-error-flow
|
|
|
|
severity: warning
|
|
|
|
disabled: false
|
|
|
|
arguments:
|
|
|
|
- "preserveScope"
|
|
|
|
- name: range-val-in-closure
|
|
|
|
severity: warning
|
|
|
|
disabled: false
|
|
|
|
- name: range-val-address
|
|
|
|
severity: warning
|
|
|
|
disabled: false
|
|
|
|
- name: string-of-int
|
|
|
|
severity: warning
|
|
|
|
disabled: false
|
2022-06-10 14:58:07 +08:00
|
|
|
misspell:
|
|
|
|
locale: US
|
|
|
|
gocritic:
|
|
|
|
enabled-checks:
|
|
|
|
- ruleguard
|
|
|
|
settings:
|
|
|
|
ruleguard:
|
|
|
|
failOnError: true
|
2023-10-11 21:01:35 +08:00
|
|
|
rules: "rules.go"
|
2023-02-26 11:31:49 +08:00
|
|
|
depguard:
|
2023-06-07 19:34:36 +08:00
|
|
|
rules:
|
|
|
|
main:
|
|
|
|
deny:
|
2023-10-11 21:01:35 +08:00
|
|
|
- pkg: "errors"
|
2023-06-07 19:34:36 +08:00
|
|
|
desc: not allowd, use github.com/cockroachdb/errors
|
2023-10-11 21:01:35 +08:00
|
|
|
- pkg: "github.com/pkg/errors"
|
2023-06-07 19:34:36 +08:00
|
|
|
desc: not allowd, use github.com/cockroachdb/errors
|
2023-10-11 21:01:35 +08:00
|
|
|
- pkg: "github.com/pingcap/errors"
|
2023-06-07 19:34:36 +08:00
|
|
|
desc: not allowd, use github.com/cockroachdb/errors
|
2023-10-11 21:01:35 +08:00
|
|
|
- pkg: "golang.org/x/xerrors"
|
2023-06-07 19:34:36 +08:00
|
|
|
desc: not allowd, use github.com/cockroachdb/errors
|
2023-10-11 21:01:35 +08:00
|
|
|
- pkg: "github.com/go-errors/errors"
|
2023-06-07 19:34:36 +08:00
|
|
|
desc: not allowd, use github.com/cockroachdb/errors
|
2023-03-10 15:53:53 +08:00
|
|
|
forbidigo:
|
|
|
|
forbid:
|
|
|
|
- '^time\.Tick$'
|
2023-09-26 17:15:27 +08:00
|
|
|
- 'return merr\.Err[a-zA-Z]+'
|
|
|
|
- 'merr\.Wrap\w+\(\)\.Error\(\)'
|
|
|
|
- '\.(ErrorCode|Reason) = '
|
|
|
|
- 'Reason:\s+\w+\.Error\(\)'
|
2023-10-07 11:29:32 +08:00
|
|
|
- 'errors.New\((.+)\.GetReason\(\)\)'
|
2023-10-11 21:01:35 +08:00
|
|
|
- 'commonpb\.Status\{[\s\n]*ErrorCode:[\s\n]*.+[\s\S\n]*?\}'
|
2023-03-10 15:53:53 +08:00
|
|
|
#- 'fmt\.Print.*' WIP
|
2020-11-03 11:25:47 +08:00
|
|
|
|
2020-11-12 12:04:12 +08:00
|
|
|
issues:
|
|
|
|
exclude-use-default: false
|
2023-10-11 21:01:35 +08:00
|
|
|
exclude-rules:
|
|
|
|
- path: .+_test\.go
|
|
|
|
linters:
|
|
|
|
- forbidigo
|
2020-11-12 12:04:12 +08:00
|
|
|
exclude:
|
|
|
|
- should have a package comment
|
|
|
|
- should have comment
|
|
|
|
- should be of the form
|
|
|
|
- should not use dot imports
|
|
|
|
- which can be annoying to use
|
2021-09-18 14:45:50 +08:00
|
|
|
# Binds to all network interfaces
|
|
|
|
- G102
|
|
|
|
# Errors unhandled
|
|
|
|
- G104
|
|
|
|
# file/folder Permission
|
|
|
|
- G301
|
|
|
|
- G302
|
|
|
|
# Potential file inclusion via variable
|
|
|
|
- G304
|
2023-02-26 11:31:49 +08:00
|
|
|
# Deferring unsafe method like *os.File Close
|
2021-09-18 14:45:50 +08:00
|
|
|
- G307
|
2023-08-08 10:15:07 +08:00
|
|
|
# TLS MinVersion too low
|
|
|
|
- G402
|
2021-09-18 14:45:50 +08:00
|
|
|
# Use of weak random number generator math/rand
|
|
|
|
- G404
|
2023-09-19 10:05:22 +08:00
|
|
|
# Unused parameters
|
|
|
|
- SA1019
|
|
|
|
# defer return errors
|
|
|
|
- SA5001
|
|
|
|
|
2021-09-24 10:39:54 +08:00
|
|
|
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
|
|
|
|
max-issues-per-linter: 0
|
|
|
|
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
|
|
|
|
max-same-issues: 0
|