gitea源码

.golangci.yml 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. version: "2"
  2. output:
  3. sort-order:
  4. - file
  5. linters:
  6. default: none
  7. enable:
  8. - bidichk
  9. - depguard
  10. - dupl
  11. - errcheck
  12. - forbidigo
  13. - gocritic
  14. - govet
  15. - ineffassign
  16. - mirror
  17. - nakedret
  18. - nolintlint
  19. - perfsprint
  20. - revive
  21. - staticcheck
  22. - testifylint
  23. - unconvert
  24. - unparam
  25. - unused
  26. - usestdlibvars
  27. - usetesting
  28. - wastedassign
  29. settings:
  30. depguard:
  31. rules:
  32. main:
  33. deny:
  34. - pkg: encoding/json
  35. desc: use gitea's modules/json instead of encoding/json
  36. - pkg: github.com/unknwon/com
  37. desc: use gitea's util and replacements
  38. - pkg: io/ioutil
  39. desc: use os or io instead
  40. - pkg: golang.org/x/exp
  41. desc: it's experimental and unreliable
  42. - pkg: code.gitea.io/gitea/modules/git/internal
  43. desc: do not use the internal package, use AddXxx function instead
  44. - pkg: gopkg.in/ini.v1
  45. desc: do not use the ini package, use gitea's config system instead
  46. - pkg: gitea.com/go-chi/cache
  47. desc: do not use the go-chi cache package, use gitea's cache system
  48. nolintlint:
  49. allow-unused: false
  50. require-explanation: true
  51. require-specific: true
  52. gocritic:
  53. enabled-checks:
  54. - equalFold
  55. disabled-checks:
  56. - ifElseChain
  57. - singleCaseSwitch # Every time this occurred in the code, there was no other way.
  58. revive:
  59. severity: error
  60. rules:
  61. - name: atomic
  62. - name: bare-return
  63. - name: blank-imports
  64. - name: constant-logical-expr
  65. - name: context-as-argument
  66. - name: context-keys-type
  67. - name: dot-imports
  68. - name: duplicated-imports
  69. - name: empty-lines
  70. - name: error-naming
  71. - name: error-return
  72. - name: error-strings
  73. - name: errorf
  74. - name: exported
  75. - name: identical-branches
  76. - name: if-return
  77. - name: increment-decrement
  78. - name: indent-error-flow
  79. - name: modifies-value-receiver
  80. - name: package-comments
  81. - name: range
  82. - name: receiver-naming
  83. - name: redefines-builtin-id
  84. - name: string-of-int
  85. - name: superfluous-else
  86. - name: time-naming
  87. - name: unconditional-recursion
  88. - name: unexported-return
  89. - name: unreachable-code
  90. - name: var-declaration
  91. - name: var-naming
  92. arguments:
  93. - [] # AllowList - do not remove as args for the rule are positional and won't work without lists first
  94. - [] # DenyList
  95. - - skip-package-name-checks: true # supress errors from underscore in migration packages
  96. staticcheck:
  97. checks:
  98. - all
  99. - -ST1003
  100. - -ST1005
  101. - -QF1001
  102. - -QF1006
  103. - -QF1008
  104. testifylint:
  105. disable:
  106. - go-require
  107. - require-error
  108. usetesting:
  109. os-temp-dir: true
  110. exclusions:
  111. generated: lax
  112. presets:
  113. - comments
  114. - common-false-positives
  115. - legacy
  116. - std-error-handling
  117. rules:
  118. - linters:
  119. - dupl
  120. - errcheck
  121. - gocyclo
  122. - gosec
  123. - staticcheck
  124. - unparam
  125. path: _test\.go
  126. - linters:
  127. - dupl
  128. - errcheck
  129. - gocyclo
  130. - gosec
  131. path: models/migrations/v
  132. - linters:
  133. - forbidigo
  134. path: cmd
  135. - linters:
  136. - dupl
  137. text: (?i)webhook
  138. - linters:
  139. - gocritic
  140. text: (?i)`ID' should not be capitalized
  141. - linters:
  142. - deadcode
  143. - unused
  144. text: (?i)swagger
  145. - linters:
  146. - staticcheck
  147. text: (?i)argument x is overwritten before first use
  148. - linters:
  149. - gocritic
  150. text: '(?i)commentFormatting: put a space between `//` and comment text'
  151. - linters:
  152. - gocritic
  153. text: '(?i)exitAfterDefer:'
  154. paths:
  155. - node_modules
  156. - public
  157. - web_src
  158. - third_party$
  159. - builtin$
  160. - examples$
  161. issues:
  162. max-issues-per-linter: 0
  163. max-same-issues: 0
  164. formatters:
  165. enable:
  166. - gofmt
  167. - gofumpt
  168. settings:
  169. gofumpt:
  170. extra-rules: true
  171. exclusions:
  172. generated: lax
  173. paths:
  174. - node_modules
  175. - public
  176. - web_src
  177. - third_party$
  178. - builtin$
  179. - examples$
  180. run:
  181. timeout: 10m