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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.20"
  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.20"
  77. depguard:
  78. list-type: denylist
  79. # Check the list against standard lib.
  80. include-go-root: true
  81. packages-with-error-message:
  82. - encoding/json: "use gitea's modules/json instead of encoding/json"
  83. - github.com/unknwon/com: "use gitea's util and replacements"
  84. - io/ioutil: "use os or io instead"
  85. - golang.org/x/exp: "it's experimental and unreliable."
  86. - code.gitea.io/gitea/modules/git/internal: "do not use the internal package, use AddXxx function instead"
  87. - gopkg.in/ini.v1: "do not use the ini package, use gitea's config system instead"
  88. issues:
  89. max-issues-per-linter: 0
  90. max-same-issues: 0
  91. exclude-rules:
  92. # Exclude some linters from running on tests files.
  93. - path: _test\.go
  94. linters:
  95. - gocyclo
  96. - errcheck
  97. - dupl
  98. - gosec
  99. - unparam
  100. - staticcheck
  101. - path: models/migrations/v
  102. linters:
  103. - gocyclo
  104. - errcheck
  105. - dupl
  106. - gosec
  107. - path: cmd
  108. linters:
  109. - forbidigo
  110. - linters:
  111. - dupl
  112. text: "webhook"
  113. - linters:
  114. - gocritic
  115. text: "`ID' should not be capitalized"
  116. - linters:
  117. - unused
  118. - deadcode
  119. text: "swagger"
  120. - linters:
  121. - staticcheck
  122. text: "argument x is overwritten before first use"
  123. - text: "commentFormatting: put a space between `//` and comment text"
  124. linters:
  125. - gocritic
  126. - text: "exitAfterDefer:"
  127. linters:
  128. - gocritic