.golangci.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. linters-settings:
  2. depguard:
  3. list-type: blacklist
  4. packages:
  5. # logging is allowed only by logutils.Log, logrus
  6. # is allowed to use only in logutils package
  7. - github.com/sirupsen/logrus
  8. packages-with-error-message:
  9. - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
  10. dupl:
  11. threshold: 125
  12. funlen:
  13. lines: 125
  14. statements: 50
  15. gci:
  16. local-prefixes: github.com/golangci/golangci-lint
  17. goconst:
  18. min-len: 2
  19. min-occurrences: 2
  20. gocritic:
  21. enabled-tags:
  22. - diagnostic
  23. - experimental
  24. - performance
  25. #- style
  26. #- opinionated
  27. disabled-checks:
  28. - commentFormatting
  29. - commentedOutCode
  30. - dupImport # https://github.com/go-critic/go-critic/issues/845
  31. - ifElseChain
  32. - octalLiteral
  33. - whyNoLint
  34. - wrapperFunc
  35. gocyclo:
  36. min-complexity: 15
  37. goimports:
  38. local-prefixes: github.com/golangci/golangci-lint
  39. gomnd:
  40. settings:
  41. mnd:
  42. # don't include the "operation" and "assign"
  43. checks: argument,case,condition,return
  44. govet:
  45. check-shadowing: true
  46. settings:
  47. printf:
  48. funcs:
  49. - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
  50. - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
  51. - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
  52. - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
  53. lll:
  54. line-length: 140
  55. maligned:
  56. suggest-new: true
  57. misspell:
  58. locale: en_CA
  59. nolintlint:
  60. allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
  61. allow-unused: false # report any unused nolint directives
  62. require-explanation: false # don't require an explanation for nolint directives
  63. require-specific: false # don't require nolint directives to be specific about which linter is being skipped
  64. linters:
  65. # please, do not use `enable-all`: it's deprecated and will be removed soon.
  66. # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
  67. disable-all: true
  68. enable:
  69. - bodyclose
  70. - depguard
  71. - dogsled
  72. - dupl
  73. - errcheck
  74. - exhaustive
  75. - exportloopref
  76. - funlen
  77. - gochecknoinits
  78. - goconst
  79. - gocritic
  80. - gocyclo
  81. - gofmt
  82. - goimports
  83. #- golint
  84. - gomnd
  85. - goprintffuncname
  86. - gosec
  87. - gosimple
  88. - govet
  89. - ineffassign
  90. #- interfacer
  91. - lll
  92. - misspell
  93. #- nakedret
  94. - noctx
  95. - nolintlint
  96. - rowserrcheck
  97. #- scopelint
  98. - staticcheck
  99. #- structcheck
  100. - stylecheck
  101. - typecheck
  102. - unconvert
  103. - unparam
  104. - unused
  105. #- varcheck
  106. - whitespace
  107. # don't enable:
  108. # - asciicheck
  109. # - deadcode
  110. # - gochecknoglobals
  111. # - gocognit
  112. # - godot
  113. # - godox
  114. # - goerr113
  115. # - golint
  116. # - interfacer
  117. # - maligned
  118. # - nestif
  119. # - prealloc
  120. ## - rowserrcheck
  121. # - scopelint
  122. # - structcheck
  123. # - testpackage
  124. # - varcheck
  125. # - wsl
  126. issues:
  127. # Excluding configuration per-path, per-linter, per-text and per-source
  128. exclude-rules:
  129. - path: _test\.go
  130. linters:
  131. - gomnd
  132. # https://github.com/go-critic/go-critic/issues/926
  133. - linters:
  134. - gocritic
  135. text: "unnecessaryDefer:"
  136. # TODO temporary rule, must be removed
  137. # seems related to v0.34.1, but I was not able to reproduce locally,
  138. # I was also not able to reproduce in the CI of a fork,
  139. # only the golangci-lint CI seems to be affected by this invalid analysis.
  140. - path: pkg/golinters/scopelint.go
  141. text: 'directive `//nolint:interfacer` is unused for linter interfacer'
  142. run:
  143. skip-dirs:
  144. - test/testdata_etc
  145. - internal/cache
  146. - internal/renameio
  147. - internal/robustio
  148. # golangci.com configuration
  149. # https://github.com/golangci/golangci/wiki/Configuration
  150. service:
  151. golangci-lint-version: 1.23.x # use the fixed version to not introduce new linters unexpectedly
  152. prepare:
  153. - echo "here I can run custom commands, but no preparation needed for this repo"