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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. timeout: 10m
  32. linters-settings:
  33. stylecheck:
  34. checks: ["all", "-ST1005", "-ST1003"]
  35. nakedret:
  36. max-func-lines: 0
  37. gocritic:
  38. disabled-checks:
  39. - ifElseChain
  40. - singleCaseSwitch # Every time this occurred in the code, there was no other way.
  41. revive:
  42. ignore-generated-header: false
  43. severity: warning
  44. confidence: 0.8
  45. errorCode: 1
  46. warningCode: 1
  47. rules:
  48. - name: blank-imports
  49. - name: context-as-argument
  50. - name: context-keys-type
  51. - name: dot-imports
  52. - name: error-return
  53. - name: error-strings
  54. - name: error-naming
  55. - name: exported
  56. - name: if-return
  57. - name: increment-decrement
  58. - name: var-naming
  59. - name: var-declaration
  60. - name: package-comments
  61. - name: range
  62. - name: receiver-naming
  63. - name: time-naming
  64. - name: unexported-return
  65. - name: indent-error-flow
  66. - name: errorf
  67. - name: duplicated-imports
  68. - name: modifies-value-receiver
  69. gofumpt:
  70. extra-rules: true
  71. depguard:
  72. rules:
  73. main:
  74. deny:
  75. - pkg: encoding/json
  76. desc: use gitea's modules/json instead of encoding/json
  77. - pkg: github.com/unknwon/com
  78. desc: use gitea's util and replacements
  79. - pkg: io/ioutil
  80. desc: use os or io instead
  81. - pkg: golang.org/x/exp
  82. desc: it's experimental and unreliable
  83. - pkg: code.gitea.io/gitea/modules/git/internal
  84. desc: do not use the internal package, use AddXxx function instead
  85. - pkg: gopkg.in/ini.v1
  86. desc: do not use the ini package, use gitea's config system instead
  87. - pkg: gitea.com/go-chi/cache
  88. desc: do not use the go-chi cache package, use gitea's cache system
  89. issues:
  90. max-issues-per-linter: 0
  91. max-same-issues: 0
  92. exclude-dirs: [node_modules, public, web_src]
  93. exclude-rules:
  94. # Exclude some linters from running on tests files.
  95. - path: _test\.go
  96. linters:
  97. - gocyclo
  98. - errcheck
  99. - dupl
  100. - gosec
  101. - unparam
  102. - staticcheck
  103. - path: models/migrations/v
  104. linters:
  105. - gocyclo
  106. - errcheck
  107. - dupl
  108. - gosec
  109. - path: cmd
  110. linters:
  111. - forbidigo
  112. - linters:
  113. - dupl
  114. text: "webhook"
  115. - linters:
  116. - gocritic
  117. text: "`ID' should not be capitalized"
  118. - linters:
  119. - unused
  120. - deadcode
  121. text: "swagger"
  122. - linters:
  123. - staticcheck
  124. text: "argument x is overwritten before first use"
  125. - text: "commentFormatting: put a space between `//` and comment text"
  126. linters:
  127. - gocritic
  128. - text: "exitAfterDefer:"
  129. linters:
  130. - gocritic