forked from kcp-dev/kcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yaml
More file actions
160 lines (160 loc) · 4.23 KB
/
Copy path.golangci.yaml
File metadata and controls
160 lines (160 loc) · 4.23 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
version: "2"
run:
allow-parallel-runners: true
linters:
default: none
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- copyloopvar
- dupword
- durationcheck
- errcheck
- errchkjson
- fatcontext
- gocritic
- godot
- goprintffuncname
- gosec
- govet
- importas
- ineffassign
- intrange
- misspell
- nilerr
- noctx
- nolintlint
- nosprintfhostport
- paralleltest
- prealloc
- revive
- staticcheck
- testifylint
- unconvert
- unused
- usestdlibvars
- whitespace
# TODO(vincepri): Figure out if we want to enable or remove the following linters:
# - predeclared
# - goconst
settings:
gocritic:
disabled-checks:
- appendAssign
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- typeDefFirst
- unnamedResult
- whyNoLint
- unnecessaryBlock
- rangeValCopy
- hugeParam
- commentedOutCode
- emptyStringTest
- singleCaseSwitch
- nestingReduce
- tooManyResultsChecker
enabled-tags:
- diagnostic
- experimental
- performance
gosec:
excludes:
- G307 # Deferring unsafe method "Close" on type "\*os.File"
- G108 # Profiling endpoint is automatically exposed on /debug/pprof
# TODO(vincepri): The following should be looked at and removed in future iterations.
- G401 # Use of weak cryptographic primitive (replace sha1 usage)
- G505 # crypto/sha1: weak cryptographic primitive
- G402 # TLS MinVersion too low (set MinVersion in TLSClientConfig)
- G404 # Use of weak random number generator (use crypto/rand)
- G101 # Potential hardcoded credentials (returns false positives)
- G306 # Expect WriteFile permissions to be 0600 or less
# gosec is currently producing a lot of false-positives on taint analysis.
# see https://github.com/securego/gosec/issues/1500
- G704
- G705
misspell:
ignore-rules:
- creater
nolintlint:
require-specific: true
allow-unused: false
revive:
# make sure error-strings issues actually surface (default confidence is 0.8)
confidence: 0.6
rules:
- name: context-keys-type
- name: duplicated-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: if-return
- name: increment-decrement
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: errorf
- name: superfluous-else
- name: unreachable-code
- name: bool-literal-in-expr
- name: constant-logical-expr
# TODO(vincepri): Figure out if we want to enable
# the following rules, or remove them completely, they're a bit noisy.
# - name: context-as-argument
# - name: var-naming
# - name: exported
# - name: unexported-return
# - name: blank-imports
# - name: indent-error-flow # I think @ncdc prefers explicit else statements, remove?
# - name: redefines-builtin-id
# - name: dot-imports
paralleltest:
check-cleanup: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- gosec
path: test/e2e/*
- linters:
- staticcheck
text: QF1008 # "could remove embedded field" often impedes readability and clarity
paths:
- third_party
# TODO(embik): this is a blanket ignore specifically because of github.com/dev-kcp/client-go.
- listers
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
- gofmt
settings:
gci:
sections:
- standard
- default
- prefix(k8s.io)
- prefix(github.com/kcp-dev)
- prefix(github.com/kcp-dev/kcp)
- blank
- dot
custom-order: true
exclusions:
generated: disable
paths:
- third_party$
- builtin$
- examples$