cadvisor/.golangci.yml
iwankgb 854445c010
Carefully fixing style (#2509)
* Use golangci-lint to add lint presubmit test, and fix linter errors

Signed-off-by: Maciej "Iwan" Iwanowski <maciej.iwanowski@intel.com>
2020-04-22 16:26:36 -07:00

61 lines
2.9 KiB
YAML

run:
linters-settings:
govet:
enable-all: true
golint:
min-confidence: 0
linters:
disable-all: true
enable:
- govet
- errcheck
- staticcheck
- unused
- gosimple
- structcheck
- varcheck
- ineffassign
- deadcode
- typecheck
- golint
issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-case-sensitive: true
exclude:
# integration/tests/api/event_test.go:66:6: func `waitForStaticEvent` is unused (unused)
# Flaky test skipped.
- waitForStaticEvent
# Initialism or acronyms for fields, vars and types:
- "(struct field|var|type|const) `[A-Z].*` should be `.*`"
# Initialism or acronyms - renaming exported methods and functions can be tricky:
- "(method|func) [A-Z].* should be .*"
# Stuttering affects exported names:
- "type name will be used as .*\\.[A-Z]{1}.* by other packages, and that stutters"
# We would have to change exported function return type:
- "exported func .* returns unexported type"
exclude-rules:
# container/containerd/client.go:67:4: SA1019: grpc.WithDialer is deprecated: use WithContextDialer instead. Will be supported throughout 1.x. (staticcheck)
# There are more similar issues in following lines.
- path: container/containerd/client.go
text: "SA1019:"
# utils/cpuload/netlink/netlink.go:102:15: Error return value of `binary.Write` is not checked (errcheck)
# There are more similar issues in this file
- path: utils/cpuload/netlink/netlink.go
text: "Error return value of `binary.Write` is not checked"
# utils/cloudinfo/aws/aws.go:60:28: SA1019: session.New is deprecated: Use NewSession functions to create sessions instead. NewSession has the same functionality as New except an error can be returned when the func is called instead of waiting to receive an error until a request is made. (staticcheck)
- path: utils/cloudinfo/aws/aws.go
text: "SA1019:"
# events/handler.go:151:51: exported func NewEventManager returns unexported type *github.com/google/cadvisor/events.events, which can be annoying to use (golint)
- path: events/handler.go
text: "exported func NewEventManager returns unexported type .{1}github.com/google/cadvisor/events.events, which can be annoying to use"
# manager/manager_test.go:277:29: Error return value of `(*github.com/google/cadvisor/container/testing.MockContainerHandler).GetSpec` is not checked (errcheck)
- path: manager/manager_test.go
text: "Error return value of `.{2}github.com/google/cadvisor/container/testing.MockContainerHandler.{1}.GetSpec` is not checked"
# utils/sysinfo/sysinfo.go:208:7: ineffectual assignment to `err` (ineffassign)
- path: utils/sysinfo/sysinfo.go
text: "ineffectual assignment to `err`|SA4006:"
# cache/memory/memory_test.go:81:23: Error return value of `memoryCache.AddStats` is not checked (errcheck)
- path: cache/memory/memory_test.go
text: "Error return value of `memoryCache.AddStats` is not checked"