-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
154 lines (143 loc) · 4.42 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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
run:
concurrency: 4
timeout: 5m
issues-exit-code: 2
tests: true
output:
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
path-prefix: ""
sort-results: true
linters:
enable-all: true
disable:
- containedctx
- gochecknoglobals
- gochecknoinits
- gofumpt
- ireturn
# deprecated linters
- gomnd
- execinquery
linters-settings:
# Checks if package imports are in a list of acceptable packages.
depguard:
rules:
main:
# Used to determine the package matching priority.
# There are three different modes: `original`, `strict`, and `lax`.
# Default: "original"
list-mode: lax
# List of file globs that will match this list of settings to compare against.
# Default: $all
files:
- "$all"
# List of allowed packages.
allow:
- "$gostd"
deny:
- pkg: "io/ioutil"
desc: "replaced by io and os packages since Go 1.16"
- pkg: "reflect"
desc: "not allowed"
domain:
list-mode: lax
files:
- "**/domain/**"
deny:
- pkg: "github.com/lesismal/nbio"
desc: not allowed
- pkg: "go.mongodb.org/mongo-driver"
desc: not allowed
- pkg: "github.com/golang-jwt/jwt/v5"
desc: not allowed
api:
list-mode: lax
files:
- "**/api/**"
deny:
- pkg: "github.com/lesismal/nbio"
desc: not allowed
- pkg: "go.mongodb.org/mongo-driver"
desc: not allowed
data:
list-mode: lax
files:
- "**/infra/data/**"
deny:
- pkg: "github.com/lesismal/nbio"
desc: not allowed
- pkg: "github.com/golang-jwt/jwt/v5"
desc: not allowed
web:
list-mode: lax
files:
- "**/infra/web/**"
deny:
- pkg: "github.com/golang-jwt/jwt/v5"
desc: not allowed
- pkg: "go.mongodb.org/mongo-driver"
desc: not allowed
# Checks function and package cyclomatic complexity.
cyclop:
# The maximal code complexity to report.
# Default: 10
max-complexity: 9
# The maximal average package complexity.
# If it's higher than 0.0 (float) the check is enabled
# Default: 0.0
package-average: 6.0
# Should ignore tests.
# Default: false
skip-tests: true
# Gci controls Go package import order and makes it always deterministic.
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot > alias`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(ttt) # Custom: groups all imports with the specified Prefix.
- blank
- dot
- alias
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true
# Checks if all structure fields are initialized.
exhaustruct:
# List of regexes to exclude struct packages and their names from checks.
# Regexes must match complete canonical struct package/name.
# Default: []
exclude:
- '.+/nbhttp\.Config'
# Check exhaustiveness of enum switch statements.
exhaustive:
# Program elements to check for exhaustiveness.
# Default: [ switch ]
check:
- switch
- map
# Presence of "default" case in switch statements satisfies exhaustiveness,
# even if all enum members are not listed.
# Default: false
default-signifies-exhaustive: true
# Find code that shadows one of Go's predeclared identifiers.
predeclared:
# Comma-separated list of predeclared identifiers to not report on.
# Default: ""
ignore: "delete"
# Include method names and field names (i.e., qualified names) in checks.
# Default: false
q: true
# Checks that the length of a variable's name matches its scope.
varnamelen:
# Optional list of variable names that should be ignored completely.
# Default: []
ignore-names:
- ok