.golangci.yml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. # v2.0.0. Created based on golangci-lint v2.6.1
  2. version: "2"
  3. run:
  4. timeout: 5m
  5. modules-download-mode: readonly
  6. allow-serial-runners: true
  7. output:
  8. sort-order:
  9. - file
  10. - linter
  11. issues:
  12. max-issues-per-linter: 0
  13. max-same-issues: 0
  14. uniq-by-line: false
  15. # fix: true
  16. linters:
  17. exclusions:
  18. paths:
  19. - internal # TODO: Do not ignore interal packages
  20. rules:
  21. - linters:
  22. - err113
  23. text: 'do not define dynamic errors, use wrapped static errors instead.*'
  24. - path: log/.*\\.go
  25. linters:
  26. - depguard
  27. # Exclude some linters from running on tests files.
  28. - path: _test\\.go
  29. linters:
  30. - bodyclose
  31. settings:
  32. depguard:
  33. rules:
  34. all:
  35. list-mode: lax
  36. deny:
  37. - pkg: "flag"
  38. desc: '`flag` package is only allowed in main.go'
  39. - pkg: "log"
  40. desc: 'logging is provided by `pkg/log`'
  41. - pkg: "io/ioutil"
  42. desc: '`io/ioutil` package is deprecated, use the `io` and `os` package instead'
  43. # TODO: Prevent using these without a reason
  44. # - pkg: "reflect"
  45. # desc: '`reflect` package is dangerous to use'
  46. # - pkg: "unsafe"
  47. # desc: '`unsafe` package is dangerous to use'
  48. errcheck:
  49. check-type-assertions: true
  50. check-blank: true
  51. disable-default-exclusions: true
  52. exclude-functions:
  53. - '(*bytes.Buffer).Write' # always returns nil error
  54. - '(*strings.Builder).WriteByte' # always returns nil error
  55. - '(*strings.Builder).WriteString' # always returns nil error
  56. errchkjson:
  57. report-no-exported: true
  58. exhaustive:
  59. default-signifies-exhaustive: true
  60. forbidigo:
  61. forbid:
  62. - pattern: ^print(ln)?$
  63. - pattern: ^fmt\.Print(f|ln)?$
  64. - pattern: ^http\.Default(Client|ServeMux|Transport)$
  65. # TODO: Eventually enable these patterns
  66. # - ^panic$
  67. # - ^time\.Sleep$
  68. analyze-types: true
  69. goconst:
  70. numbers: true
  71. gocritic:
  72. # TODO: Uncomment the following lines
  73. enabled-tags:
  74. - diagnostic
  75. # - style
  76. # - performance
  77. # - experimental
  78. # - opinionated
  79. disabled-checks:
  80. - ifElseChain
  81. settings:
  82. captLocal:
  83. paramsOnly: false
  84. elseif:
  85. skipBalanced: false
  86. underef:
  87. skipRecvDeref: false
  88. # NOTE: Set this option to false if other projects rely on this project's code
  89. # unnamedResult:
  90. # checkExported: false
  91. gosec:
  92. excludes:
  93. - G104 # TODO: Enable this again. Mostly provided by errcheck
  94. - G115
  95. config:
  96. global:
  97. # show-ignored: true # TODO: Enable this
  98. audit: true
  99. govet:
  100. enable-all: true
  101. disable:
  102. - fieldalignment
  103. - shadow
  104. grouper:
  105. # const-require-grouping: true # TODO: Enable this
  106. import-require-single-import: true
  107. import-require-grouping: true
  108. # var-require-grouping: true # TODO: Conflicts with gofumpt
  109. loggercheck:
  110. require-string-key: true
  111. no-printf-like: true
  112. misspell:
  113. locale: US
  114. nolintlint:
  115. require-explanation: true
  116. require-specific: true
  117. nonamedreturns:
  118. report-error-in-defer: true
  119. perfsprint:
  120. err-error: true
  121. predeclared:
  122. qualified-name: true
  123. promlinter:
  124. strict: true
  125. # TODO: Enable this
  126. # reassign:
  127. # patterns:
  128. # - '.*'
  129. revive:
  130. enable-all-rules: true
  131. rules:
  132. # Provided by gomnd linter
  133. - name: add-constant
  134. disabled: true
  135. - name: argument-limit
  136. disabled: true
  137. # Provided by bidichk
  138. - name: banned-characters
  139. disabled: true
  140. - name: cognitive-complexity
  141. disabled: true
  142. - name: comment-spacings
  143. arguments:
  144. - nolint
  145. disabled: true # TODO: Do not disable
  146. - name: cyclomatic
  147. disabled: true
  148. # TODO: Enable this check. Currently disabled due to upstream bug.
  149. # - name: enforce-repeated-arg-type-style
  150. # arguments:
  151. # - short
  152. - name: enforce-slice-style
  153. arguments:
  154. - make
  155. disabled: true # TODO: Do not disable
  156. - name: exported
  157. disabled: true
  158. - name: file-header
  159. disabled: true
  160. - name: function-result-limit
  161. arguments: [3]
  162. - name: function-length
  163. disabled: true
  164. - name: line-length-limit
  165. disabled: true
  166. - name: max-public-structs
  167. disabled: true
  168. - name: modifies-parameter
  169. disabled: true
  170. - name: nested-structs
  171. disabled: true # TODO: Do not disable
  172. - name: package-comments
  173. disabled: true
  174. - name: optimize-operands-order
  175. disabled: true
  176. - name: unchecked-type-assertion
  177. disabled: true # TODO: Do not disable
  178. - name: unhandled-error
  179. disabled: true
  180. - name: enforce-switch-style
  181. disabled: true
  182. - name: var-naming
  183. disabled: true
  184. staticcheck:
  185. checks:
  186. - all
  187. - -QF1003
  188. - -ST1000
  189. - -ST1020
  190. - -ST1021
  191. - -ST1022
  192. tagalign:
  193. strict: true
  194. tagliatelle:
  195. case:
  196. rules:
  197. json: snake
  198. testifylint:
  199. enable-all: true
  200. testpackage:
  201. skip-regexp: "^$"
  202. unparam:
  203. # NOTE: Set this option to false if other projects rely on this project's code
  204. check-exported: false
  205. unused:
  206. # TODO: Uncomment these two lines
  207. # parameters-are-used: false
  208. # local-variables-are-used: false
  209. # NOTE: Set these options to true if other projects rely on this project's code
  210. field-writes-are-uses: true
  211. # exported-is-used: true # TODO: Fix issues with this option (upstream)
  212. exported-fields-are-used: true
  213. usestdlibvars:
  214. http-method: true
  215. http-status-code: true
  216. time-weekday: false # TODO: Set to true
  217. time-month: false # TODO: Set to true
  218. time-layout: false # TODO: Set to true
  219. crypto-hash: true
  220. default-rpc-path: true
  221. sql-isolation-level: true
  222. tls-signature-scheme: true
  223. constant-kind: true
  224. wrapcheck:
  225. ignore-package-globs:
  226. - github.com/gofiber/utils/*
  227. - github.com/valyala/fasthttp
  228. enable:
  229. - asasalint
  230. - asciicheck
  231. - bidichk
  232. - bodyclose
  233. - containedctx
  234. - contextcheck
  235. # - cyclop
  236. - decorder
  237. - depguard
  238. - dogsled
  239. # - dupl
  240. # - dupword # TODO: Enable
  241. - durationcheck
  242. - errcheck
  243. - errchkjson
  244. - errname
  245. - errorlint
  246. - exhaustive
  247. # - exhaustivestruct
  248. # - exhaustruct
  249. - forbidigo
  250. - forcetypeassert
  251. # - funlen
  252. # - gci # TODO: Enable
  253. - ginkgolinter
  254. # - gocheckcompilerdirectives # TODO: Enable
  255. # - gochecknoglobals # TODO: Enable
  256. # - gochecknoinits # TODO: Enable
  257. - gochecksumtype
  258. # - gocognit
  259. # - goconst # TODO: Enable
  260. - gocritic
  261. # - gocyclo
  262. # - godot
  263. # - godox
  264. - err113
  265. # - goheader
  266. # - goimports
  267. # - golint
  268. # - gomnd # TODO: Enable
  269. - gomoddirectives
  270. # - gomodguard
  271. - goprintffuncname
  272. - gosec
  273. # - gosmopolitan # TODO: Enable
  274. - govet
  275. - grouper
  276. # - ifshort # TODO: Enable
  277. # - importas
  278. # - inamedparam
  279. - ineffassign
  280. # - interfacebloat
  281. # - interfacer
  282. # - ireturn
  283. # - lll
  284. - loggercheck
  285. # - maintidx
  286. - makezero
  287. # - maligned
  288. - mirror
  289. - misspell
  290. - musttag
  291. - nakedret
  292. # - nestif
  293. - nilerr
  294. - nilnil
  295. # - nlreturn
  296. - noctx
  297. - nolintlint
  298. - nonamedreturns
  299. - nosprintfhostport
  300. # - paralleltest # TODO: Enable
  301. - perfsprint
  302. # - prealloc
  303. - predeclared
  304. - promlinter
  305. - protogetter
  306. - reassign
  307. - revive
  308. - rowserrcheck
  309. # - scopelint # TODO: Enable
  310. - sloglint
  311. - spancheck
  312. - sqlclosecheck
  313. - staticcheck
  314. # - stylecheck # TODO: Enable
  315. # - tagalign # TODO: Enable
  316. - tagliatelle
  317. - testableexamples
  318. - testifylint
  319. # - testpackage # TODO: Enable
  320. - thelper
  321. - tparallel
  322. - unconvert
  323. - unparam
  324. - unused
  325. - usestdlibvars
  326. # - varnamelen
  327. # - wastedassign # TODO: Enable
  328. - whitespace
  329. #- wrapcheck
  330. # - wsl
  331. - zerologlint
  332. formatters:
  333. enable:
  334. - gofmt
  335. - gofumpt
  336. settings:
  337. gci:
  338. sections:
  339. - standard
  340. - prefix(github.com/gofiber/utils)
  341. - default
  342. - blank
  343. - dot
  344. # - alias
  345. custom-order: true
  346. gofumpt:
  347. module-path: github.com/gofiber/utils
  348. extra-rules: true