You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.golangci.yml 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. linters:
  2. enable:
  3. - gosimple
  4. - deadcode
  5. - typecheck
  6. - govet
  7. - errcheck
  8. - staticcheck
  9. - unused
  10. - structcheck
  11. - varcheck
  12. - dupl
  13. #- gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
  14. - gofmt
  15. - misspell
  16. - gocritic
  17. - bidichk
  18. - ineffassign
  19. - revive
  20. - gofumpt
  21. - depguard
  22. - nakedret
  23. - unconvert
  24. - wastedassign
  25. - nolintlint
  26. - stylecheck
  27. enable-all: false
  28. disable-all: true
  29. fast: false
  30. run:
  31. go: 1.19
  32. timeout: 10m
  33. skip-dirs:
  34. - node_modules
  35. - public
  36. - web_src
  37. linters-settings:
  38. stylecheck:
  39. checks: ["all", "-ST1005", "-ST1003"]
  40. nakedret:
  41. max-func-lines: 0
  42. gocritic:
  43. disabled-checks:
  44. - ifElseChain
  45. - singleCaseSwitch # Every time this occurred in the code, there was no other way.
  46. revive:
  47. ignore-generated-header: false
  48. severity: warning
  49. confidence: 0.8
  50. errorCode: 1
  51. warningCode: 1
  52. rules:
  53. - name: blank-imports
  54. - name: context-as-argument
  55. - name: context-keys-type
  56. - name: dot-imports
  57. - name: error-return
  58. - name: error-strings
  59. - name: error-naming
  60. - name: exported
  61. - name: if-return
  62. - name: increment-decrement
  63. - name: var-naming
  64. - name: var-declaration
  65. - name: package-comments
  66. - name: range
  67. - name: receiver-naming
  68. - name: time-naming
  69. - name: unexported-return
  70. - name: indent-error-flow
  71. - name: errorf
  72. - name: duplicated-imports
  73. - name: modifies-value-receiver
  74. gofumpt:
  75. extra-rules: true
  76. lang-version: "1.19"
  77. depguard:
  78. # TODO: use depguard to replace import checks in gitea-vet
  79. list-type: denylist
  80. # Check the list against standard lib.
  81. include-go-root: true
  82. packages-with-error-message:
  83. - encoding/json: "use gitea's modules/json instead of encoding/json"
  84. - github.com/unknwon/com: "use gitea's util and replacements"
  85. issues:
  86. max-issues-per-linter: 0
  87. max-same-issues: 0
  88. exclude-rules:
  89. # Exclude some linters from running on tests files.
  90. - path: _test\.go
  91. linters:
  92. - gocyclo
  93. - errcheck
  94. - dupl
  95. - gosec
  96. - unparam
  97. - staticcheck
  98. - path: models/migrations/v
  99. linters:
  100. - gocyclo
  101. - errcheck
  102. - dupl
  103. - gosec
  104. - linters:
  105. - dupl
  106. text: "webhook"
  107. - linters:
  108. - gocritic
  109. text: "`ID' should not be capitalized"
  110. - path: modules/templates/helper.go
  111. linters:
  112. - gocritic
  113. - linters:
  114. - unused
  115. - deadcode
  116. text: "swagger"
  117. - path: contrib/pr/checkout.go
  118. linters:
  119. - errcheck
  120. - path: models/issue.go
  121. linters:
  122. - errcheck
  123. - path: models/migrations/
  124. linters:
  125. - errcheck
  126. - path: modules/log/
  127. linters:
  128. - errcheck
  129. - path: routers/api/v1/repo/issue_subscription.go
  130. linters:
  131. - dupl
  132. - path: routers/repo/view.go
  133. linters:
  134. - dupl
  135. - path: models/migrations/
  136. linters:
  137. - unused
  138. - linters:
  139. - staticcheck
  140. text: "argument x is overwritten before first use"
  141. - path: modules/httplib/httplib.go
  142. linters:
  143. - staticcheck
  144. # Enabling this would require refactoring the methods and how they are called.
  145. - path: models/issue_comment_list.go
  146. linters:
  147. - dupl
  148. - linters:
  149. - misspell
  150. text: '`Unknwon` is a misspelling of `Unknown`'
  151. - path: models/update.go
  152. linters:
  153. - unused
  154. - path: cmd/dump.go
  155. linters:
  156. - dupl
  157. - path: services/webhook/webhook.go
  158. linters:
  159. - structcheck
  160. - text: "commentFormatting: put a space between `//` and comment text"
  161. linters:
  162. - gocritic
  163. - text: "exitAfterDefer:"
  164. linters:
  165. - gocritic
  166. - path: modules/graceful/manager_windows.go
  167. linters:
  168. - staticcheck
  169. text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."
  170. - path: models/user/openid.go
  171. linters:
  172. - golint
  173. - path: models/user/badge.go
  174. linters:
  175. - revive
  176. text: "exported: type name will be used as user.UserBadge by other packages, and that stutters; consider calling this Badge"