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

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