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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. linters:
  2. enable:
  3. - bidichk
  4. # - deadcode # deprecated - https://github.com/golangci/golangci-lint/issues/1841
  5. - depguard
  6. - dupl
  7. - errcheck
  8. - forbidigo
  9. - gocritic
  10. # - gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
  11. - gofmt
  12. - gofumpt
  13. - gosimple
  14. - govet
  15. - ineffassign
  16. - nakedret
  17. - nolintlint
  18. - revive
  19. - staticcheck
  20. # - structcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841
  21. - stylecheck
  22. - typecheck
  23. - unconvert
  24. - unused
  25. # - varcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841
  26. - wastedassign
  27. enable-all: false
  28. disable-all: true
  29. fast: false
  30. run:
  31. go: "1.21"
  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.21"
  77. depguard:
  78. rules:
  79. main:
  80. deny:
  81. - pkg: encoding/json
  82. desc: use gitea's modules/json instead of encoding/json
  83. - pkg: github.com/unknwon/com
  84. desc: use gitea's util and replacements
  85. - pkg: io/ioutil
  86. desc: use os or io instead
  87. - pkg: golang.org/x/exp
  88. desc: it's experimental and unreliable
  89. - pkg: code.gitea.io/gitea/modules/git/internal
  90. desc: do not use the internal package, use AddXxx function instead
  91. - pkg: gopkg.in/ini.v1
  92. desc: do not use the ini package, use gitea's config system instead
  93. issues:
  94. max-issues-per-linter: 0
  95. max-same-issues: 0
  96. exclude-rules:
  97. # Exclude some linters from running on tests files.
  98. - path: _test\.go
  99. linters:
  100. - gocyclo
  101. - errcheck
  102. - dupl
  103. - gosec
  104. - unparam
  105. - staticcheck
  106. - path: models/migrations/v
  107. linters:
  108. - gocyclo
  109. - errcheck
  110. - dupl
  111. - gosec
  112. - path: cmd
  113. linters:
  114. - forbidigo
  115. - linters:
  116. - dupl
  117. text: "webhook"
  118. - linters:
  119. - gocritic
  120. text: "`ID' should not be capitalized"
  121. - linters:
  122. - unused
  123. - deadcode
  124. text: "swagger"
  125. - linters:
  126. - staticcheck
  127. text: "argument x is overwritten before first use"
  128. - text: "commentFormatting: put a space between `//` and comment text"
  129. linters:
  130. - gocritic
  131. - text: "exitAfterDefer:"
  132. linters:
  133. - gocritic