.golangci.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. rules:
  81. # Exclude some linters from running on tests files.
  82. - path: _test(ing)?\.go
  83. linters:
  84. - gocyclo
  85. - errcheck
  86. - dupl
  87. - gosec
  88. - unparam
  89. - lll
  90. - revive
  91. # Allow dot imports for Ginkgo and Gomega in test files
  92. - path: _test\.go
  93. text: "dot-imports:"
  94. linters:
  95. - revive
  96. # Ease some gocritic warnings on test files.
  97. - path: _test\.go
  98. text: "(unnamedResult|exitAfterDefer)"
  99. linters:
  100. - gocritic
  101. # Exclude fake or mock packages from revive linter
  102. - path: /(fake|mock)/
  103. linters:
  104. - revive
  105. # This is a "potential hardcoded credentials" warning. It's triggered by
  106. # any variable with 'secret' in the same, and thus hits a lot of false
  107. # positives in Kubernetes land where a Secret is an object type.
  108. - text: "G101:"
  109. linters:
  110. - gosec
  111. # The header check doesn't correctly parse the header as a code comment and is
  112. # triggered by the perceived diff. The header check still correctly detects missing
  113. # license headers and is useful for some cases.
  114. - text: "Actual:"
  115. linters:
  116. - goheader
  117. issues:
  118. # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  119. max-issues-per-linter: 0
  120. # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  121. max-same-issues: 0
  122. formatters:
  123. enable:
  124. - gci
  125. - gofmt
  126. - goimports
  127. - golines
  128. settings:
  129. goimports:
  130. local-prefixes:
  131. - github.com/external-secrets/external-secrets
  132. golines:
  133. # Target maximum line length.
  134. # Default: 100
  135. max-len: 200
  136. gci:
  137. sections:
  138. - "standard"
  139. - "default"
  140. - "prefix(github.com/external-secrets/external-secrets)"
  141. - "blank"
  142. - "dot"