forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
100 lines (92 loc) · 3.05 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# See explanation of linters at https://golangci-lint.run/usage/linters/
linters:
disable-all: true
enable:
- bodyclose
# Disabled due to flakes: https://github.com/sourcegraph/sourcegraph/issues/33183
# - depguard
- forbidigo
- gocritic
- goimports
- gosimple
- govet
- ineffassign
# this is flakey: https://github.com/sourcegraph/sourcegraph/issues/34304
# - nolintlint
- staticcheck
- typecheck
- unconvert
- unused
- unparam
- exportloopref
linters-settings:
depguard:
list-type: denylist
include-go-root: true
packages-with-error-message:
# Deprecated packages
- io/ioutil: "The ioutil package has been deprecated"
# Blacklisted error packages
- errors: "Use github.com/sourcegraph/sourcegraph/lib/errors instead"
- github.com/pkg/errors: "Use github.com/sourcegraph/sourcegraph/lib/errors instead"
- github.com/cockroachdb/errors: "Use github.com/sourcegraph/sourcegraph/lib/errors instead"
- github.com/hashicorp/go-multierror: "Use github.com/sourcegraph/sourcegraph/lib/errors instead"
# More performant regexp
- regexp: "Use github.com/grafana/regexp instead"
gocritic:
disabled-checks:
- appendAssign # Too many false positives
- assignOp # Maybe worth adding, but likely not worth the noise
- commentFormatting # No strong benefit
- deprecatedComment # Unnecessary
- exitAfterDefer # Only occurs in auxiliary tools
- ifElseChain # Noisy for not much gain
- singleCaseSwitch # Noisy for not much gain
govet:
disable:
- composites
forbidigo:
forbid:
# Use errors.Newf instead
- '^fmt\.Errorf$'
issues:
exclude-rules:
# Exclude bodyclose lint from tests because leaking connections in tests
# is a non-issue, and checking that adds unnecessary noise
- path: _test\.go
linters:
- bodyclose
run:
timeout: 5m
skip-dirs:
- client
- ui
- vendor
- node_modules
- docker-images/syntax-highlighter
skip-files:
# Auto-generated with depguard and forbidigo failures
- schema/schema.go
# Imports blacklisted errors
# Unfortunately golangci-lint doesn't really like multiple go.mod files, so
# whenever we reference a file here it's relative to its containing workspace.
# These values are under the ./lib module.
- errors/cockroach.go
# These are all projects with distinct go.mod files that can't import lib
# due to not knowing an absolute path to the user's sourcegraph directory
# and go mod replace directives not accepting relative paths.
#
# We should remove the go.mod files in these directories and share the set
# of dependencies in the root module (which has access to the colocated lib)
# like we did with sg. That seemed very successful!
# In ./enterprise/dev/insight-data-gen
- main.go
# In ./internal/cmd/progress-bot
- main.go
# In ./internal/cmd/resources-report
- aws.go
- gcp.go
- main.go
- resource.go
- sheets.go
- slack.go