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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.18
  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.18"
  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. exclude-rules:
  87. # Exclude some linters from running on tests files.
  88. - path: _test\.go
  89. linters:
  90. - gocyclo
  91. - errcheck
  92. - dupl
  93. - gosec
  94. - unparam
  95. - staticcheck
  96. - path: models/migrations/v
  97. linters:
  98. - gocyclo
  99. - errcheck
  100. - dupl
  101. - gosec
  102. - linters:
  103. - dupl
  104. text: "webhook"
  105. - linters:
  106. - gocritic
  107. text: "`ID' should not be capitalized"
  108. - path: modules/templates/helper.go
  109. linters:
  110. - gocritic
  111. - linters:
  112. - unused
  113. - deadcode
  114. text: "swagger"
  115. - path: contrib/pr/checkout.go
  116. linters:
  117. - errcheck
  118. - path: models/issue.go
  119. linters:
  120. - errcheck
  121. - path: models/migrations/
  122. linters:
  123. - errcheck
  124. - path: modules/log/
  125. linters:
  126. - errcheck
  127. - path: routers/api/v1/repo/issue_subscription.go
  128. linters:
  129. - dupl
  130. - path: routers/repo/view.go
  131. linters:
  132. - dupl
  133. - path: models/migrations/
  134. linters:
  135. - unused
  136. - linters:
  137. - staticcheck
  138. text: "argument x is overwritten before first use"
  139. - path: modules/httplib/httplib.go
  140. linters:
  141. - staticcheck
  142. # Enabling this would require refactoring the methods and how they are called.
  143. - path: models/issue_comment_list.go
  144. linters:
  145. - dupl
  146. - linters:
  147. - misspell
  148. text: '`Unknwon` is a misspelling of `Unknown`'
  149. - path: models/update.go
  150. linters:
  151. - unused
  152. - path: cmd/dump.go
  153. linters:
  154. - dupl
  155. - path: services/webhook/webhook.go
  156. linters:
  157. - structcheck
  158. - text: "commentFormatting: put a space between `//` and comment text"
  159. linters:
  160. - gocritic
  161. - text: "exitAfterDefer:"
  162. linters:
  163. - gocritic
  164. - path: modules/graceful/manager_windows.go
  165. linters:
  166. - staticcheck
  167. text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."
  168. - path: models/user/openid.go
  169. linters:
  170. - golint