.golangci.yml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. version: "2"
  2. run:
  3. modules-download-mode: readonly
  4. allow-serial-runners: true
  5. linters:
  6. enable:
  7. - asasalint
  8. - asciicheck
  9. - bidichk
  10. - bodyclose
  11. - containedctx
  12. - contextcheck
  13. - copyloopvar
  14. - decorder
  15. - depguard
  16. - dogsled
  17. - dupword
  18. - durationcheck
  19. - err113
  20. - errchkjson
  21. - errname
  22. - errorlint
  23. - exhaustive
  24. - forbidigo
  25. - forcetypeassert
  26. - ginkgolinter
  27. - gochecksumtype
  28. - goconst
  29. - gocritic
  30. - gomoddirectives
  31. - goprintffuncname
  32. - gosec
  33. - grouper
  34. - loggercheck
  35. - makezero
  36. - mirror
  37. - misspell
  38. - musttag
  39. - nakedret
  40. - nilerr
  41. - nilnil
  42. # - noctx # TODO: enable this once the codebase is migrated to context aware APIs
  43. - nolintlint
  44. - nonamedreturns
  45. - nosprintfhostport
  46. - perfsprint
  47. - predeclared
  48. - promlinter
  49. - protogetter
  50. - reassign
  51. - revive
  52. - rowserrcheck
  53. - sloglint
  54. - spancheck
  55. - sqlclosecheck
  56. - staticcheck
  57. - tagliatelle
  58. - testableexamples
  59. - testifylint
  60. - thelper
  61. - tparallel
  62. - unconvert
  63. - unparam
  64. - usestdlibvars
  65. - whitespace
  66. - wrapcheck
  67. - zerologlint
  68. settings:
  69. depguard:
  70. rules:
  71. all:
  72. list-mode: lax
  73. deny:
  74. - pkg: flag
  75. desc: "`flag` package is only allowed in main.go"
  76. - pkg: log
  77. desc: logging is provided by `pkg/log`
  78. - pkg: io/ioutil
  79. desc: "`io/ioutil` package is deprecated, use the `io` and `os` package instead"
  80. errcheck:
  81. disable-default-exclusions: true
  82. check-type-assertions: true
  83. check-blank: true
  84. exclude-functions:
  85. - (*bytes.Buffer).Write
  86. - (*github.com/valyala/bytebufferpool.ByteBuffer).Write
  87. - (*github.com/valyala/bytebufferpool.ByteBuffer).WriteByte
  88. - (*github.com/valyala/bytebufferpool.ByteBuffer).WriteString
  89. errchkjson:
  90. report-no-exported: true
  91. exhaustive:
  92. default-signifies-exhaustive: true
  93. forbidigo:
  94. forbid:
  95. - pattern: ^print(ln)?$
  96. - pattern: ^fmt\.Print(f|ln)?$
  97. - pattern: ^http\.Default(Client|ServeMux|Transport)$
  98. analyze-types: true
  99. goconst:
  100. numbers: true
  101. gocritic:
  102. enabled-tags:
  103. - diagnostic
  104. - style
  105. - performance
  106. settings:
  107. captLocal:
  108. paramsOnly: false
  109. elseif:
  110. skipBalanced: false
  111. underef:
  112. skipRecvDeref: false
  113. gosec:
  114. excludes:
  115. - G104
  116. config:
  117. global:
  118. audit: true
  119. govet:
  120. enable-all: true
  121. grouper:
  122. import-require-single-import: true
  123. import-require-grouping: true
  124. loggercheck:
  125. require-string-key: true
  126. no-printf-like: true
  127. misspell:
  128. locale: US
  129. nolintlint:
  130. require-explanation: true
  131. require-specific: true
  132. nonamedreturns:
  133. report-error-in-defer: true
  134. perfsprint:
  135. err-error: true
  136. predeclared:
  137. qualified-name: true
  138. promlinter:
  139. strict: true
  140. revive:
  141. enable-all-rules: true
  142. rules:
  143. - name: add-constant
  144. disabled: true
  145. - name: argument-limit
  146. disabled: true
  147. - name: banned-characters
  148. disabled: true
  149. - name: cognitive-complexity
  150. disabled: true
  151. - name: confusing-results
  152. disabled: true
  153. - name: comment-spacings
  154. arguments:
  155. - nolint
  156. disabled: true
  157. - name: cyclomatic
  158. disabled: true
  159. - name: enforce-slice-style
  160. arguments:
  161. - make
  162. disabled: true
  163. - name: exported
  164. disabled: true
  165. - name: file-header
  166. disabled: true
  167. - name: function-result-limit
  168. arguments:
  169. - 3
  170. - name: function-length
  171. disabled: true
  172. - name: line-length-limit
  173. disabled: true
  174. - name: max-public-structs
  175. disabled: true
  176. - name: modifies-parameter
  177. disabled: true
  178. - name: nested-structs
  179. disabled: true
  180. - name: package-comments
  181. disabled: true
  182. - name: optimize-operands-order
  183. disabled: true
  184. - name: unchecked-type-assertion
  185. disabled: true
  186. - name: unhandled-error
  187. disabled: true
  188. staticcheck:
  189. checks:
  190. - all
  191. - -ST1000
  192. - -ST1020
  193. - -ST1021
  194. - -ST1022
  195. tagalign:
  196. strict: true
  197. tagliatelle:
  198. case:
  199. rules:
  200. json: snake
  201. testifylint:
  202. enable-all: true
  203. testpackage:
  204. skip-regexp: ^$
  205. unparam:
  206. check-exported: false
  207. unused:
  208. field-writes-are-uses: true
  209. exported-fields-are-used: true
  210. usestdlibvars:
  211. http-method: true
  212. http-status-code: true
  213. time-weekday: false
  214. time-month: false
  215. time-layout: false
  216. crypto-hash: true
  217. default-rpc-path: true
  218. sql-isolation-level: true
  219. tls-signature-scheme: true
  220. constant-kind: true
  221. wrapcheck:
  222. ignore-package-globs:
  223. - github.com/gofiber/fiber/*
  224. - github.com/valyala/fasthttp
  225. exclusions:
  226. generated: lax
  227. rules:
  228. - text: (?i)do not define dynamic errors, use wrapped static errors instead*
  229. linters:
  230. - err113
  231. - path: log/.*\.go
  232. linters:
  233. - depguard
  234. - path: _test\.go
  235. linters:
  236. - bodyclose
  237. - err113
  238. - goconst # disabling goconst in test files only
  239. - source: (?i)fmt.Fprintf?
  240. linters:
  241. - errcheck
  242. - revive
  243. paths:
  244. - _msgp\.go
  245. - _msgp_test\.go
  246. - third_party$
  247. - builtin$
  248. - examples$
  249. issues:
  250. max-issues-per-linter: 0
  251. max-same-issues: 0
  252. formatters:
  253. enable:
  254. - gofmt
  255. - gofumpt
  256. - goimports
  257. settings:
  258. gci:
  259. sections:
  260. - standard
  261. - prefix(github.com/gofiber/fiber)
  262. - default
  263. - blank
  264. - dot
  265. custom-order: true
  266. gofumpt:
  267. module-path: github.com/gofiber/fiber
  268. extra-rules: true
  269. exclusions:
  270. generated: lax
  271. paths:
  272. - _msgp\.go
  273. - _msgp_test\.go
  274. - third_party$
  275. - builtin$
  276. - examples$