-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy path.golangci.yml
72 lines (66 loc) · 3.25 KB
/
.golangci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
run:
skip-files:
- cmd/agent/app/reloadcheck.go # ignore unused command for now
- cmd/agent/app/listchecks.go # ignore unused command for now
- pkg/util/cloudproviders/cloudfoundry/bbscache_test.go # implements interface from imported package whose method names fail linting
issues:
# Do not limit the number of issues per linter.
max-issues-per-linter: 0
# Do not limit the number of times a same issue is reported.
max-same-issues: 0
exclude:
- "`eventContext` is unused"
- "`\\(\\*DatadogLogger\\).changeLogLevel` is unused"
- "`defaultRetryDuration` is unused" # used by APM and Process
- "`defaultRetries` is unused" # used by APM and Process
- "python._Ctype_char, which can be annoying to use" # ignore warning about returning unexported field from CGO
# ignore warning on linux about fields used only on windows
- "`context` is unused"
- "`id` is unused"
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- errcheck
# typecheck is broken with build tags
- path: ".*.go"
linters: [typecheck]
# Ignore name repetition for checks (docker.Docker*, jmx.JMX*, etc.)
- path: pkg/collector/corechecks/
text: "name will be used as .* by other packages, and that stutters"
- path: pkg/util/docker/
text: "name will be used as .* by other packages, and that stutters"
- path: pkg/util/containers/cri
text: "name will be used as .* by other packages, and that stutters"
- path: pkg/util/containerd
text: "name will be used as .* by other packages, and that stutters"
# TODO: Needs manual update
- text: "package github.com/golang/protobuf/proto is deprecated: .*"
linters: [staticcheck]
linters:
disable-all: true
enable:
- deadcode # Finds unused code
- structcheck # Finds unused struct fields
- unconvert # Remove unnecessary type conversions
- unused # Checks Go code for unused constants, variables, functions and types
- ineffassign # Detects when assignments to existing variables are not used
- misspell # Finds commonly misspelled English words in comments
- gofmt # Gofmt checks whether code was gofmt-ed
- revive # Revive is a replacement for golint, a coding style checker
- errcheck # errcheck is a program for checking for unchecked errors in go programs.
- staticcheck # staticcheck is a go vet on steroids, applying a ton of static analysis checks
linters-settings:
errcheck:
# Disable warnings for `fmt` and `log` packages. Also ignore `Write` functions from `net/http` package.
ignore: fmt:.*,github.com/DataDog/datadog-agent/pkg/util/log:.*,net/http:Write,github.com/DataDog/datadog-agent/pkg/trace/metrics:.*
staticcheck:
go: "1.17"
checks: ["all",
"-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", # These ones are disabled by default on staticcheck
"-ST1013", # Use HTTP code enums instead of integers
# Actual issues that should be fixed eventually
"-SA2001", # TODO: empty critical section, seems to be used for something?
"-SA6002", # TODO: Fix sync.Pools
"-SA4025", # TODO: Fix trace unit test
]