Repository navigation
Expand file tree
/
Copy path.golangci.yml
More file actions
135 lines (135 loc) · 3.74 KB
/
Copy path.golangci.yml
File metadata and controls
135 lines (135 loc) · 3.74 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
version: "2"
run:
concurrency: 2
build-tags:
- e2e # Avoid "unused" linter issues for code only used in e2e.
linters:
default: none
disable:
# gocognit deliberately replaced gocyclo — do not re-enable. Cyclomatic
# complexity charges a flat guard clause the same as a nested branch, so
# our fail-fast style accumulated //nolint suppressions on functions that
# are long but flat. Cognitive complexity penalizes nesting and barely
# charges early returns, keeping the signal on genuinely tangled code.
- gocyclo
enable:
- copyloopvar
- depguard
- errcheck
- errorlint
- forbidigo
- gocognit
- gocritic
- gomodguard_v2
- govet
- ineffassign
- lll
- misspell
- nakedret
- nolintlint
- perfsprint
- revive
- staticcheck
- testifylint
- unconvert
- unparam
- unused
settings:
depguard:
rules:
all:
deny:
- pkg: io/ioutil
desc: io/ioutil package has been deprecated
- pkg: github.com/docker/docker/errdefs
desc: use github.com/containerd/errdefs instead.
- pkg: golang.org/x/exp/maps
desc: use stdlib maps package
- pkg: golang.org/x/exp/slices
desc: use stdlib slices package
- pkg: gopkg.in/yaml.v2
desc: compose-go uses yaml.v3
- pkg: github.com/stretchr/testify/assert
desc: Use "gotest.tools/v3/assert" instead
- pkg: github.com/stretchr/testify/require
desc: Use "gotest.tools/v3/assert" instead
- pkg: github.com/stretchr/testify/suite
desc: Do not use
library-not-cli:
# pkg/ is the SDK and internal/ its support code: neither may depend
# on the CLI. A CLI-only component the library needs goes behind an
# interface that cmd/ implements and injects (e.g. WithNavigationMenu).
files:
- "**/pkg/**"
- "**/internal/**"
- "!**/pkg/e2e/**"
deny:
- pkg: github.com/docker/compose/v5/cmd
desc: the library must not depend on the CLI, inject an implementation instead.
forbidigo:
analyze-types: true
forbid:
- pattern: 'context\.Background'
pkg: '^context$'
msg: "in tests, use t.Context() instead of context.Background()"
- pattern: 'context\.TODO'
pkg: '^context$'
msg: "in tests, use t.Context() instead of context.TODO()"
gocritic:
disabled-checks:
- paramTypeCombine
- unnamedResult
- whyNoLint
enabled-tags:
- diagnostic
- opinionated
- style
gocognit:
min-complexity: 30
gomodguard_v2:
blocked:
- module: github.com/pkg/errors
recommendations:
- errors
- fmt
- module: github.com/distribution/distribution
reason: use distribution/reference
- module: gotest.tools
version: < 3.0.0
reason: deprecated, pre-modules version
lll:
line-length: 200
revive:
rules:
- name: package-comments
disabled: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
rules:
- path-except: '_test\.go'
linters:
- forbidigo
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
- gofumpt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
settings:
gci:
sections:
- standard
- default
- localmodule
custom-order: true # make the section order the same as the order of "sections".