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 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. enable-all: false
  23. disable-all: true
  24. fast: false
  25. run:
  26. go: 1.18
  27. timeout: 10m
  28. skip-dirs:
  29. - node_modules
  30. - public
  31. - web_src
  32. linters-settings:
  33. gocritic:
  34. disabled-checks:
  35. - ifElseChain
  36. - singleCaseSwitch # Every time this occurred in the code, there was no other way.
  37. revive:
  38. ignore-generated-header: false
  39. severity: warning
  40. confidence: 0.8
  41. errorCode: 1
  42. warningCode: 1
  43. rules:
  44. - name: blank-imports
  45. - name: context-as-argument
  46. - name: context-keys-type
  47. - name: dot-imports
  48. - name: error-return
  49. - name: error-strings
  50. - name: error-naming
  51. - name: exported
  52. - name: if-return
  53. - name: increment-decrement
  54. - name: var-naming
  55. - name: var-declaration
  56. - name: package-comments
  57. - name: range
  58. - name: receiver-naming
  59. - name: time-naming
  60. - name: unexported-return
  61. - name: indent-error-flow
  62. - name: errorf
  63. - name: duplicated-imports
  64. - name: modifies-value-receiver
  65. gofumpt:
  66. extra-rules: true
  67. lang-version: "1.18"
  68. depguard:
  69. # TODO: use depguard to replace import checks in gitea-vet
  70. list-type: denylist
  71. # Check the list against standard lib.
  72. include-go-root: true
  73. packages-with-error-message:
  74. - encoding/json: "use gitea's modules/json instead of encoding/json"
  75. - github.com/unknwon/com: "use gitea's util and replacements"
  76. issues:
  77. exclude-rules:
  78. # Exclude some linters from running on tests files.
  79. - path: _test\.go
  80. linters:
  81. - gocyclo
  82. - errcheck
  83. - dupl
  84. - gosec
  85. - unparam
  86. - staticcheck
  87. - path: models/migrations/v
  88. linters:
  89. - gocyclo
  90. - errcheck
  91. - dupl
  92. - gosec
  93. - linters:
  94. - dupl
  95. text: "webhook"
  96. - linters:
  97. - gocritic
  98. text: "`ID' should not be capitalized"
  99. - path: modules/templates/helper.go
  100. linters:
  101. - gocritic
  102. - linters:
  103. - unused
  104. - deadcode
  105. text: "swagger"
  106. - path: contrib/pr/checkout.go
  107. linters:
  108. - errcheck
  109. - path: models/issue.go
  110. linters:
  111. - errcheck
  112. - path: models/migrations/
  113. linters:
  114. - errcheck
  115. - path: modules/log/
  116. linters:
  117. - errcheck
  118. - path: routers/api/v1/repo/issue_subscription.go
  119. linters:
  120. - dupl
  121. - path: routers/repo/view.go
  122. linters:
  123. - dupl
  124. - path: models/migrations/
  125. linters:
  126. - unused
  127. - linters:
  128. - staticcheck
  129. text: "argument x is overwritten before first use"
  130. - path: modules/httplib/httplib.go
  131. linters:
  132. - staticcheck
  133. # Enabling this would require refactoring the methods and how they are called.
  134. - path: models/issue_comment_list.go
  135. linters:
  136. - dupl
  137. - linters:
  138. - misspell
  139. text: '`Unknwon` is a misspelling of `Unknown`'
  140. - path: models/update.go
  141. linters:
  142. - unused
  143. - path: cmd/dump.go
  144. linters:
  145. - dupl
  146. - path: services/webhook/webhook.go
  147. linters:
  148. - structcheck
  149. - text: "commentFormatting: put a space between `//` and comment text"
  150. linters:
  151. - gocritic
  152. - text: "exitAfterDefer:"
  153. linters:
  154. - gocritic
  155. - path: modules/graceful/manager_windows.go
  156. linters:
  157. - staticcheck
  158. text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."
  159. - path: models/user/openid.go
  160. linters:
  161. - golint