-
Notifications
You must be signed in to change notification settings - Fork 6
/
.golangci.yml
133 lines (127 loc) · 3.22 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
run:
timeout: 10m
tests: true
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# skip-files:
skip-dirs:
- p2p #from libp2p
- mock #from gomock
- protogo #from pb generate
- sqldbprovider #will remove
- eventsqldb
- evm-go
- gasm-go
- wasmer-go
linters:
disable-all: true
enable:
- deadcode
- goconst
- gocyclo
- gofmt
- ineffassign
- staticcheck
- structcheck # 当非导出结构嵌入另一个结构, 前一个结构被使用就不会监测到, 这个需要每个业务自己屏蔽
- typecheck
- goimports
- revive
- gosimple
- govet
- lll
- rowserrcheck
- errcheck
- misspell
- unused
- varcheck
- sqlclosecheck
- gosec
linters-settings:
goconst:
min-len: 2
min-occurrences: 2
gocyclo:
min-complexity: 20
goimports:
#local-prefixes: git.code.oa.com
golint:
#min-confidence: 0
govet:
check-shadowing: true
gosimple:
go: "1.15"
lll:
line-length: 120
errcheck:
check-type-assertions: true
gocritic:
enabled-checks:
- nestingReduce
settings:
nestingReduce:
bodyWidth: 5
revive:
# see https://github.com/mgechev/revive#available-rules for details.
rules:
# - name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: if-return
- name: increment-decrement
# - name: var-naming
- name: var-declaration
- name: package-comments
- name: range
# - name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unexported-naming
- name: unexported-return
- name: unreachable-code
- name: redefines-builtin-id
- name: function-length
arguments: [ 80,0 ]
issues:
exclude-use-default: true
include:
- EXC0002 # golint (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
- EXC0003 # golint func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
#- EXC0004 # govet (possible misuse of unsafe.Pointer|should have signature)
- EXC0005 # staticcheck ineffective break statement. Did you mean to break out of the outer loop
- EXC0011 # stylecheck (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
exclude-rules:
- path: .*_test.go
linters:
- unused
- deadcode
- ineffassign
- staticcheck
- forbidigo
- dupl
- errcheck
- lll
- funlen
- linters:
- revive
text: "stutters"
- linters:
- errcheck
text: "json.Unmarshal"
- linters:
- gosec
text: "G108|G204|G501|G401"
max-same-issues: 0
new: false
max-issues-per-linter: 0
output:
sort-results: true