.golangci.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. version: "2"
  2. run:
  3. timeout: 10m
  4. allow-parallel-runners: true
  5. linters:
  6. default: none
  7. enable:
  8. - asciicheck
  9. - bodyclose
  10. - dogsled
  11. - dupl
  12. - errcheck
  13. - errorlint
  14. - exhaustive
  15. - copyloopvar
  16. - goheader
  17. - goconst
  18. - gocritic
  19. - godot
  20. - goprintffuncname
  21. - gosec
  22. - govet
  23. - ineffassign
  24. - misspell
  25. - modernize # A suite of analyzers that suggest simplifications to Go code, using modern language and library features. https://golangci-lint.run/docs/linters/configuration/#modernize
  26. - nakedret
  27. - nolintlint
  28. - prealloc
  29. - lll
  30. - unconvert
  31. - unparam
  32. - unused
  33. - whitespace
  34. - revive
  35. settings:
  36. goconst:
  37. min-len: 3
  38. min-occurrences: 3
  39. gocritic:
  40. enabled-tags:
  41. - diagnostic
  42. - experimental
  43. - opinionated
  44. - performance
  45. - style
  46. disabled-checks:
  47. - dupImport
  48. - ifElseChain
  49. - octalLiteral
  50. - whyNoLint
  51. - wrapperFunc
  52. - importShadow
  53. - unnamedResult
  54. - unnecessaryBlock
  55. settings:
  56. rangeValCopy:
  57. sizeThreshold: 512
  58. hugeParam:
  59. sizeThreshold: 512
  60. gocyclo:
  61. min-complexity: 16
  62. goheader:
  63. template-path: ${config-path}/hack/boilerplate.go.txt
  64. dupl:
  65. threshold: 200
  66. govet:
  67. disable:
  68. - shadow
  69. lll:
  70. line-length: 300
  71. # staticcheck:
  72. # checks:
  73. # - QF1008
  74. misspell:
  75. locale: US
  76. modernize:
  77. disable:
  78. - omitzero
  79. exclusions:
  80. paths:
  81. - runtime/template/v2/sprig
  82. rules:
  83. # Exclude some linters from running on tests files.
  84. - path: _test(ing)?\.go
  85. linters:
  86. - gocyclo
  87. - errcheck
  88. - dupl
  89. - gosec
  90. - unparam
  91. - lll
  92. - revive
  93. # Allow dot imports for Ginkgo and Gomega in test files
  94. - path: _test\.go
  95. text: "dot-imports:"
  96. linters:
  97. - revive
  98. # Ease some gocritic warnings on test files.
  99. - path: _test\.go
  100. text: "(unnamedResult|exitAfterDefer)"
  101. linters:
  102. - gocritic
  103. # Exclude fake or mock packages from revive linter
  104. - path: /(fake|mock)/
  105. linters:
  106. - revive
  107. # This is a "potential hardcoded credentials" warning. It's triggered by
  108. # any variable with 'secret' in the same, and thus hits a lot of false
  109. # positives in Kubernetes land where a Secret is an object type.
  110. - text: "G101:"
  111. linters:
  112. - gosec
  113. # The header check doesn't correctly parse the header as a code comment and is
  114. # triggered by the perceived diff. The header check still correctly detects missing
  115. # license headers and is useful for some cases.
  116. - text: "Actual:"
  117. linters:
  118. - goheader
  119. issues:
  120. # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  121. max-issues-per-linter: 0
  122. # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  123. max-same-issues: 0
  124. formatters:
  125. enable:
  126. - gci
  127. - gofmt
  128. - goimports
  129. - golines
  130. settings:
  131. goimports:
  132. local-prefixes:
  133. - github.com/external-secrets/external-secrets
  134. golines:
  135. # Target maximum line length.
  136. # Default: 100
  137. max-len: 200
  138. gci:
  139. sections:
  140. - "standard"
  141. - "default"
  142. - "prefix(github.com/external-secrets/external-secrets)"
  143. - "blank"
  144. - "dot"