11# Based on recommendations in https://olegk.dev/go-linters-configuration-the-right-version
22
3+ version : " 2"
34run :
4- # linter execution
5- timeout : 30m
6- issues-exit-code : 1
75 concurrency : 4
8- # check tests as well
9- tests : true
10- # fail if go.mod file is outdated.
11- modules-download-mode : readonly
12- # use the Go version from the go.mod file.
136 go : " "
14-
7+ modules-download-mode : readonly
8+ issues-exit-code : 1
9+ tests : true
10+ output :
11+ formats :
12+ text :
13+ path : stdout
14+ print-linter-name : true
15+ print-issued-lines : false
16+ colors : false
1517linters :
16- # set to true to run only fast linters (e.g., for pre-commit)
17- fast : false
18-
19- disable-all : true
18+ default : none
2019 enable :
2120 - asasalint
2221 - asciicheck
@@ -27,20 +26,16 @@ linters:
2726 - errcheck
2827 - errname
2928 - errorlint
30- - exportloopref
3129 - ginkgolinter
3230 - gocritic
3331 - godot
34- - gofumpt
35- - goimports
3632 - gosec
37- - gosimple
3833 - govet
3934 - grouper
40- - lll
41- - loggercheck
4235 - importas
4336 - ineffassign
37+ - lll
38+ - loggercheck
4439 - makezero
4540 - misspell
4641 - nakedret
@@ -57,86 +52,70 @@ linters:
5752 - reassign
5853 - revive
5954 - staticcheck
60- - stylecheck
6155 - tagliatelle
62- - tenv
6356 - testableexamples
64- - thelper
6557 - testpackage
58+ - thelper
6659 - tparallel
6760 - unconvert
6861 - unparam
6962 - unused
7063 - usestdlibvars
7164 - varnamelen
7265 - whitespace
73-
74- linters-settings :
75- gocritic :
76- enabled-tags :
77- - diagnostic
78- - experimental
79- - opinionated
80- - performance
81- - style
82-
83- errcheck :
84- # change some error checks which are disabled by default
85- check-type-assertions : true
86- check-blank : true
87-
88- nakedret :
89- # No naked returns (default: 30)
90- max-func-lines : 1
91-
92- lll :
93- # max line length, lines longer will be reported. Default is 120.
94- line-length : 130
95-
96- staticcheck :
97- checks :
98- - " all"
99-
100- stylecheck :
101-
102- varnamelen :
103- # The longest distance, in source lines, that is being considered a "small scope".
104- # Variables used in at most this many lines will be ignored (Default: 5)
105- max-distance : 20
106- # The minimum length of a variable's name that is considered "long".
107- # Variable names that are at least this long will be ignored (Default: 3)
108- min-name-length : 2
109- # Check type parameters (Default: false)
110- check-type-param : true
111- # Ignore "ok" variables that hold the bool return value of a type assertion,
112- # map index, or channel receive (default: false)
113- ignore-type-assert-ok : true
114- ignore-map-index-ok : true
115- ignore-chan-recv-ok : true
116- # Optional list of variable declarations that should be ignored completely.
117- ignore-decls :
118- - c echo.Context
119- - t *testing.T
120- - w http.ResponseWriter
121- - r *http.Request
122-
123- output :
124- # prefer the simplest output: `line-number` without saving to file
125- formats :
126- - format : line-number
127- print-issued-lines : false
128- print-linter-name : true
129- # allow multiple reports per line
130- uniq-by-line : false
131- # easier to follow the results with a deterministic output
132- sort-results : true
133-
66+ settings :
67+ errcheck :
68+ check-type-assertions : true
69+ check-blank : true
70+ gocritic :
71+ enabled-tags :
72+ - diagnostic
73+ - experimental
74+ - opinionated
75+ - performance
76+ - style
77+ lll :
78+ line-length : 130
79+ nakedret :
80+ max-func-lines : 1
81+ staticcheck :
82+ checks :
83+ - all
84+ varnamelen :
85+ max-distance : 20
86+ min-name-length : 2
87+ check-type-param : true
88+ ignore-type-assert-ok : true
89+ ignore-map-index-ok : true
90+ ignore-chan-recv-ok : true
91+ ignore-decls :
92+ - c echo.Context
93+ - t *testing.T
94+ - w http.ResponseWriter
95+ - r *http.Request
96+ exclusions :
97+ generated : lax
98+ presets :
99+ - comments
100+ - common-false-positives
101+ - legacy
102+ - std-error-handling
103+ paths :
104+ - third_party$
105+ - builtin$
106+ - examples$
134107issues :
135- # setting 0 to have all the results.
136108 max-issues-per-linter : 0
137- # nothing should be skipped to not miss errors.
138109 max-same-issues : 0
139- # analyze only new code (manually set to false to check existing code)
140110 new : true
141- # do not automatically fix (until AI assisted code improves)
142111 fix : false
112+ formatters :
113+ enable :
114+ - gofumpt
115+ - goimports
116+ exclusions :
117+ generated : lax
118+ paths :
119+ - third_party$
120+ - builtin$
121+ - examples$
0 commit comments