-
Notifications
You must be signed in to change notification settings - Fork 18
/
.golangci.yaml
142 lines (130 loc) · 3.19 KB
/
.golangci.yaml
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
# Based on recommendations in https://olegk.dev/go-linters-configuration-the-right-version
run:
# linter execution
timeout: 30m
issues-exit-code: 1
concurrency: 4
# check tests as well
tests: true
# fail if go.mod file is outdated.
modules-download-mode: readonly
# use the Go version from the go.mod file.
go: ""
linters:
# set to true to run only fast linters (e.g., for pre-commit)
fast: false
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- contextcheck
- durationcheck
- errcheck
- errname
- errorlint
- exportloopref
- ginkgolinter
- gocritic
- godot
- gofumpt
- goimports
- gosec
- gosimple
- govet
- grouper
- lll
- loggercheck
- importas
- ineffassign
- makezero
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- prealloc
- predeclared
- promlinter
- reassign
- revive
- staticcheck
- stylecheck
- tagliatelle
- tenv
- testableexamples
- thelper
- testpackage
- tparallel
- unconvert
- unparam
- unused
- usestdlibvars
- varnamelen
- whitespace
linters-settings:
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
errcheck:
# change some error checks which are disabled by default
check-type-assertions: true
check-blank: true
nakedret:
# No naked returns (default: 30)
max-func-lines: 1
lll:
# max line length, lines longer will be reported. Default is 120.
line-length: 130
staticcheck:
checks:
- "all"
stylecheck:
varnamelen:
# The longest distance, in source lines, that is being considered a "small scope".
# Variables used in at most this many lines will be ignored (Default: 5)
max-distance: 20
# The minimum length of a variable's name that is considered "long".
# Variable names that are at least this long will be ignored (Default: 3)
min-name-length: 2
# Check type parameters (Default: false)
check-type-param: true
# Ignore "ok" variables that hold the bool return value of a type assertion,
# map index, or channel receive (default: false)
ignore-type-assert-ok: true
ignore-map-index-ok: true
ignore-chan-recv-ok: true
# Optional list of variable declarations that should be ignored completely.
ignore-decls:
- c echo.Context
- t *testing.T
- w http.ResponseWriter
- r *http.Request
output:
# prefer the simplest output: `line-number` without saving to file
formats:
- format: line-number
print-issued-lines: false
print-linter-name: true
# allow multiple reports per line
uniq-by-line: false
# easier to follow the results with a deterministic output
sort-results: true
issues:
# setting 0 to have all the results.
max-issues-per-linter: 0
# nothing should be skipped to not miss errors.
max-same-issues: 0
# analyze only new code (manually set to false to check existing code)
new: true
# do not automatically fix (until AI assisted code improves)
fix: false