.golangci.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. # Created based on v1.52.2
  2. # NOTE: Keep this in sync with the version in .github/workflows/lint_golangci-lint.yml
  3. run:
  4. timeout: 5m
  5. modules-download-mode: readonly
  6. skip-dirs-use-default: false
  7. skip-dirs:
  8. - internal
  9. output:
  10. sort-results: true
  11. linters-settings:
  12. depguard:
  13. include-go-root: true
  14. packages:
  15. - flag
  16. - io/ioutil
  17. - reflect
  18. - unsafe
  19. packages-with-error-message:
  20. - flag: '`flag` package is only allowed in main.go'
  21. - io/ioutil: '`io/ioutil` package is deprecated, use the `io` and `os` package instead'
  22. - reflect: '`reflect` package is dangerous to use'
  23. - unsafe: '`unsafe` package is dangerous to use'
  24. errcheck:
  25. check-type-assertions: true
  26. check-blank: true
  27. disable-default-exclusions: true
  28. errchkjson:
  29. report-no-exported: true
  30. exhaustive:
  31. check-generated: true
  32. default-signifies-exhaustive: true
  33. forbidigo:
  34. forbid:
  35. - ^(fmt\.Print(|f|ln)|print|println)$
  36. # - 'http\.Default(Client|Transport)'
  37. # - 'time\.Sleep'
  38. # - 'panic'
  39. gci:
  40. sections:
  41. - standard
  42. - prefix(github.com/gofiber/fiber)
  43. - default
  44. - blank
  45. - dot
  46. custom-order: true
  47. goconst:
  48. numbers: true
  49. gocritic:
  50. enabled-tags:
  51. - diagnostic
  52. - style
  53. - performance
  54. - experimental
  55. - opinionated
  56. disabled-checks:
  57. - hugeParam
  58. - rangeValCopy
  59. gofumpt:
  60. module-path: github.com/gofiber/template
  61. extra-rules: true
  62. gosec:
  63. config:
  64. global:
  65. audit: true
  66. govet:
  67. enable-all: true
  68. disable:
  69. - fieldalignment
  70. - shadow
  71. grouper:
  72. import-require-single-import: true
  73. import-require-grouping: true
  74. misspell:
  75. locale: US
  76. nolintlint:
  77. require-explanation: true
  78. require-specific: true
  79. nonamedreturns:
  80. report-error-in-defer: true
  81. predeclared:
  82. q: true
  83. promlinter:
  84. strict: true
  85. reassign:
  86. patterns:
  87. - '.*'
  88. revive:
  89. enable-all-rules: true
  90. rules:
  91. # Provided by gomnd linter
  92. - name: add-constant
  93. disabled: true
  94. - name: argument-limit
  95. disabled: true
  96. # Provided by bidichk
  97. - name: banned-characters
  98. disabled: true
  99. - name: cognitive-complexity
  100. disabled: true
  101. - name: comment-spacings
  102. arguments:
  103. - nolint
  104. - msgp
  105. - name: cyclomatic
  106. disabled: true
  107. - name: exported
  108. disabled: true
  109. - name: file-header
  110. disabled: true
  111. - name: function-result-limit
  112. arguments: [3]
  113. - name: function-length
  114. disabled: true
  115. - name: line-length-limit
  116. disabled: true
  117. - name: nested-structs
  118. disabled: true
  119. - name: max-public-structs
  120. disabled: true
  121. - name: modifies-parameter
  122. disabled: true
  123. - name: package-comments
  124. disabled: true
  125. - name: use-any
  126. disabled: true # some tests still use go 1.17
  127. stylecheck:
  128. checks:
  129. - all
  130. - -ST1000
  131. - -ST1020
  132. - -ST1021
  133. - -ST1022
  134. tagliatelle:
  135. case:
  136. rules:
  137. json: snake
  138. tenv:
  139. all: true
  140. #unparam:
  141. # check-exported: true
  142. wrapcheck:
  143. ignorePackageGlobs:
  144. - github.com/gofiber/fiber/*
  145. - github.com/valyala/fasthttp
  146. issues:
  147. exclude-use-default: false
  148. exclude-rules:
  149. - linters:
  150. - goerr113
  151. text: 'do not define dynamic errors, use wrapped static errors instead*'
  152. linters:
  153. enable:
  154. - asasalint
  155. - asciicheck
  156. - bidichk
  157. - bodyclose
  158. - containedctx
  159. - contextcheck
  160. # - cyclop
  161. - deadcode
  162. # - decorder
  163. - depguard
  164. - dogsled
  165. # - dupl
  166. - dupword
  167. - durationcheck
  168. - errcheck
  169. - errchkjson
  170. - errname
  171. - errorlint
  172. - execinquery
  173. - exhaustive
  174. # - exhaustivestruct
  175. # - exhaustruct
  176. - exportloopref
  177. - forbidigo
  178. - forcetypeassert
  179. # - funlen
  180. - gci
  181. - ginkgolinter
  182. - gocheckcompilerdirectives
  183. - gochecknoglobals # Enabled
  184. - gochecknoinits # Enabled
  185. # - gocognit
  186. - goconst
  187. - gocritic
  188. # - gocyclo
  189. # - godot
  190. # - godox
  191. - goerr113
  192. - gofmt
  193. - gofumpt
  194. # - goheader
  195. # - goimports
  196. # - golint
  197. - gomnd # Enabled
  198. - gomoddirectives
  199. # - gomodguard
  200. - goprintffuncname
  201. - gosec
  202. - gosimple
  203. - govet
  204. - grouper
  205. # - ifshort
  206. # - importas
  207. - ineffassign
  208. # - interfacebloat
  209. # - interfacer
  210. # - ireturn
  211. # - lll
  212. - loggercheck
  213. # - maintidx
  214. # - makezero
  215. # - maligned
  216. - misspell
  217. - musttag
  218. - nakedret
  219. # - nestif
  220. - nilerr
  221. - nilnil
  222. # - nlreturn
  223. - noctx
  224. - nolintlint
  225. - nonamedreturns
  226. - nosnakecase
  227. - nosprintfhostport
  228. - paralleltest
  229. # - prealloc
  230. - predeclared
  231. - promlinter
  232. - reassign
  233. - revive
  234. - rowserrcheck
  235. - scopelint
  236. - sqlclosecheck
  237. - staticcheck
  238. - structcheck
  239. - stylecheck
  240. - tagliatelle
  241. - tenv
  242. - testableexamples
  243. # - testpackage
  244. - thelper
  245. - tparallel
  246. - typecheck
  247. - unconvert
  248. - unparam
  249. - unused
  250. - usestdlibvars
  251. - varcheck
  252. # - varnamelen
  253. - wastedassign
  254. - whitespace
  255. # - wrapcheck # disabled
  256. # - wsl