Skip to content

Commit a64f450

Browse files
committed
golangci: update .golangci.yml config
1 parent dd62c4c commit a64f450

File tree

1 file changed

+81
-45
lines changed

1 file changed

+81
-45
lines changed

.golangci.yml

Lines changed: 81 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
run:
2-
timeout: 1m
2+
timeout: 5m
33
issues-exit-code: 1
44
tests: true
55
skip-dirs: []
66
skip-dirs-use-default: true
7-
skip-files:
8-
- ".*\\.pb\\.go"
9-
- ".*(.|_)gen\\.go"
10-
modules-download-mode: vendor
11-
allow-parallel-runners: true
7+
skip-files: []
8+
allow-parallel-runners: false
129

1310
output:
1411
format: colored-line-number
1512
print-issued-lines: true
1613
print-linter-name: true
1714
uniq-by-line: true
15+
sort-results: true
1816

1917
linters-settings:
2018
dupl:
@@ -24,20 +22,23 @@ linters-settings:
2422
check-blank: true
2523
exclude: .errcheckignore
2624
funlen:
27-
lines: 60
28-
statements: 40
25+
lines: 100
26+
statements: 60
2927
gocognit:
30-
min-complexity: 10
28+
min-complexity: 20
3129
goconst:
3230
min-len: 3
3331
min-occurrences: 3
3432
gocritic:
3533
enabled-tags:
3634
- diagnostic
37-
- style
38-
- performance
3935
- experimental
4036
- opinionated
37+
- performance
38+
- style
39+
disabled-checks:
40+
- commentedOutCode
41+
- whyNoLint
4142
settings:
4243
hugeParam:
4344
sizeThreshold: 80
@@ -47,34 +48,40 @@ linters-settings:
4748
sizeThreshold: 128
4849
gocyclo:
4950
min-complexity: 15
51+
godot:
52+
scope: declarations
53+
capital: false
5054
gofmt:
5155
simplify: true
52-
gofumpt:
53-
extra-rules: true
5456
goimports:
55-
local-prefixes: github.com/
57+
local-prefixes: go.lsp.dev/jsonrpc2,go.lsp.dev
5658
golint:
5759
min-confidence: 0.3
5860
govet:
5961
enable-all: true
60-
disable:
61-
- shadow
62+
check-shadowing: true
6263
depguard:
6364
list-type: blacklist
64-
include-go-root: false
65+
include-go-root: true
66+
# packages-with-error-message:
67+
# - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
6568
lll:
6669
line-length: 120
6770
tab-width: 1
6871
maligned:
69-
suggest-new: false
72+
suggest-new: true
7073
misspell:
7174
locale: US
75+
ignore-words:
76+
- cancelled
7277
nakedret:
7378
max-func-lines: 30
7479
prealloc:
7580
simple: true
7681
range-loops: true
77-
for-loops: true # default: false
82+
for-loops: true
83+
testpackage:
84+
skip-regexp: '.*(export)_test\.go'
7885
unparam:
7986
check-exported: true
8087
algo: cha
@@ -86,30 +93,53 @@ linters-settings:
8693

8794
linters:
8895
fast: false
89-
disable-all: true
96+
disabled:
97+
- exhaustivestruct # Checks if all struct's fields are initialized
98+
- forbidigo # Forbids identifiers
99+
- gci # Gci control golang package import order and make it always deterministic.
100+
- gochecknoglobals # check that no global variables exist
101+
- gochecknoinits # Checks that no init functions are present in Go code
102+
- godox # Tool for detection of FIXME, TODO and other comment keywords
103+
- goerr113 # Golang linter to check the errors handling expressions
104+
- gofumpt # Gofumpt checks whether code was gofumpt-ed.
105+
- goheader # Checks is file header matches to pattern
106+
- gomnd # An analyzer to detect magic numbers.
107+
- gomodguard # Allow and block list linter for direct Go module dependencies.
108+
- gosec # Inspects source code for security problems
109+
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity
110+
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test
111+
- scopelint # Scopelint checks for unpinned variables in go programs
112+
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
113+
- testpackage
114+
- wsl # Whitespace Linter
90115
enable:
116+
- asciicheck
91117
- bodyclose
92118
- deadcode
93119
- depguard
94120
- dogsled
95121
- dupl
96122
- errcheck
123+
- errorlint
97124
- exhaustive
125+
- exportloopref
98126
- funlen
99127
- gocognit
100128
- goconst
101129
- gocritic
102130
- gocyclo
103131
- godot
104132
- gofmt
105-
- gofumpt
106133
- goimports
107134
- golint
108135
- goprintffuncname
109136
- gosimple
110137
- govet
111138
- ineffassign
112139
- interfacer
140+
- lll # Reports long lines
141+
- makezero
142+
- maligned
113143
- misspell
114144
- nakedret
115145
- nestif
@@ -120,53 +150,59 @@ linters:
120150
- staticcheck
121151
- structcheck
122152
- stylecheck
153+
- thelper
154+
- tparallel
123155
- typecheck
124156
- unconvert
125157
- unparam
126158
- unused
127159
- varcheck
128160
- whitespace
129-
disabled:
130-
# - asciicheck
131-
# - gochecknoglobals
132-
# - gochecknoinits
133-
# - godox
134-
# - goerr113
135-
# - gomnd
136-
# - gosec
137-
# - maligned
138-
# - scopelint
139-
# - testpackage
140-
# - wsl
161+
- wrapcheck
141162

142163
issues:
164+
max-same-issues: 0
143165
exclude-use-default: true
144166
exclude-rules:
145167
- path: _test\.go
146168
linters:
169+
- errcheck
147170
- funlen
171+
- gocognit
172+
- goconst
173+
- gocyclo
148174
- lll
149-
- errcheck
150-
- path: jsonrpc2.go
175+
- maligned
176+
- wrapcheck
177+
- path: "(.*)?_example_test.go"
151178
linters:
152-
- gocognit
153-
text: "func `.*.Run`"
179+
- gocritic
180+
# `TestMain` function is no longer required to call `os.Exit` since Go 1.15.
181+
# ref: https://golang.org/doc/go1.15#testing
182+
- text: "SA3000:"
183+
linters:
184+
- staticcheck
185+
# Exclude shadow checking on the variable named err
186+
- text: "shadow: declaration of \"(err|ok)\""
187+
linters:
188+
- govet
189+
# fake implements
190+
- path: fake/fake.go
191+
linters:
192+
- errcheck
193+
# future use
154194
- path: jsonrpc2.go
155195
linters:
156196
- deadcode
157197
- unused
158198
- varcheck
159199
text: "`(reqWaiting|reqDone)` is unused"
200+
# future use
160201
- linters:
161202
- deadcode
162203
- unused
163204
- varcheck
164205
text: "`(codeServerErrorStart|codeServerErrorEnd)` is unused"
165-
- path: jsonrpc2.go
166-
linters:
167-
- funlen
168-
- gocyclo
169-
- gocognit
170-
- path: stream.go
171-
linters:
172-
- gocognit
206+
# goroutine
207+
- path: handler.go
208+
text: "Error return value of `handler` is not checked"

0 commit comments

Comments
 (0)