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

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