golangci-lint.yaml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. # This file contains all available configuration options
  2. # with their default values.
  3. # options for analysis running
  4. run:
  5. # default concurrency is a available CPU number
  6. #concurrency: 4
  7. # timeout for analysis, e.g. 30s, 5m, default is 1m
  8. deadline: 30m
  9. # include test files or not, default is true
  10. tests: false
  11. # which dirs to skip: they won't be analyzed;
  12. # can use regexp here: generated.*, regexp is applied on full path;
  13. # default value is empty list, but next dirs are always skipped independently
  14. # from this option's value:
  15. # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
  16. skip-dirs:
  17. - bin$
  18. - api$
  19. - build$
  20. - configs$
  21. - deployments$
  22. - docs$
  23. - githooks$
  24. - init$
  25. - third_party$
  26. - tools$
  27. - vendor$
  28. - \.git$
  29. # which files to skip: they will be analyzed, but issues from them
  30. # won't be reported. Default value is empty list, but there is
  31. # no need to include all autogenerated files, we confidently recognize
  32. # autogenerated files. If it's not please let us know.
  33. skip-files:
  34. - "_easyjson.go"
  35. # - "_rpc.go"
  36. # - ".pb.go"
  37. # all available settings of specific linters
  38. linters-settings:
  39. errcheck:
  40. # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
  41. # default is false: such cases aren't reported by default.
  42. check-blank: true
  43. govet:
  44. # report about shadowed variables
  45. check-shadowing: true
  46. golint:
  47. # minimal confidence for issues, default is 0.8
  48. min-confidence: 0.3
  49. gocyclo:
  50. # minimal code complexity to report, 30 by default (but we recommend 10-20)
  51. min-complexity: 15
  52. gocognit:
  53. # minimal code complexity to report, 30 by default (but we recommend 10-20)
  54. min-complexity: 20
  55. dupl:
  56. # tokens count to trigger issue, 150 by default
  57. threshold: 200
  58. lll:
  59. # max line length, lines longer will be reported. Default is 120.
  60. # '\t' is counted as 1 character by default, and can be changed with the tab-width option
  61. line-length: 120
  62. nakedret:
  63. # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
  64. max-func-lines: 30
  65. funlen:
  66. lines: 80
  67. statements: 50
  68. godox:
  69. # report any comments starting with keywords, this is useful for TODO or FIXME comments that
  70. # might be left in the code accidentally and should be resolved before merging
  71. keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
  72. - TODO
  73. - BUG
  74. - FIXME
  75. - HACK
  76. dogsled:
  77. # checks assignments with too many blank identifiers; default is 2
  78. max-blank-identifiers: 2
  79. whitespace:
  80. multi-if: false # Enforces newlines (or comments) after every multi-line if statement
  81. multi-func: false # Enforces newlines (or comments) after every multi-line function signature
  82. wsl:
  83. # If true append is only allowed to be cuddled if appending value is
  84. # matching variables, fields or types on line above. Default is true.
  85. strict-append: true
  86. # Allow calls and assignments to be cuddled as long as the lines have any
  87. # matching variables, fields or types. Default is true.
  88. allow-assign-and-call: true
  89. # Allow multiline assignments to be cuddled. Default is true.
  90. allow-multiline-assign: true
  91. # Allow declarations (var) to be cuddled.
  92. allow-cuddle-declarations: false
  93. # Allow trailing comments in ending of blocks
  94. allow-trailing-comment: false
  95. # Force newlines in end of case at this limit (0 = never).
  96. force-case-trailing-whitespace: 0
  97. linters:
  98. disable-all: true
  99. enable:
  100. - bodyclose
  101. - deadcode
  102. - depguard
  103. - dupl
  104. - errcheck
  105. - goconst
  106. - gocritic
  107. - gocyclo
  108. #- godox
  109. - golint
  110. - gosec
  111. - gosimple
  112. - govet
  113. - ineffassign
  114. - interfacer
  115. - lll
  116. - misspell
  117. - nakedret
  118. - prealloc
  119. - scopelint
  120. - staticcheck
  121. - structcheck
  122. - stylecheck
  123. - typecheck
  124. - unconvert
  125. - unparam
  126. - unused
  127. - varcheck
  128. #disable:
  129. # - goimports # not needed
  130. # - maligned # not critical for us
  131. # - gochecknoglobals # we are using this
  132. # - gochecknoinits # and this
  133. # - dogsled # it is not clear how to fix problems from this linter
  134. # - gofmt # buggy linter and we have script check
  135. #
  136. # # new
  137. # - gomnd # supported from 1.22.2
  138. # - funlen # dupl of gocyclo
  139. # - gocognit # the same
  140. # - wsl # imho, useless as linter, needed autoformat tool
  141. # - whitespace # the same
  142. fast: false
  143. issues:
  144. max-issues-per-linter: 0
  145. max-same-issues: 0
  146. exclude:
  147. - "should have comment"
  148. - "always receives"
  149. - "parameter .* is always"
  150. - "comment on exported .* should be of the form"
  151. - "Use of weak cryptographic primitive"
  152. - "can be `fmt.Stringer`"
  153. - "can be `github.com/gogo/protobuf/proto.Message`"
  154. - 'ST1016: methods on the same type should have the same receiver name \(seen \d+x "[^"]+", 4x "v"\)'
  155. - 'ST1016: methods on the same type should have the same receiver name \(seen 4x "v", \d+x "[^"]+"\)'
  156. - 'ST1016: methods on the same type should have the same receiver name \(seen \d+x "[^"]+", \d+x "srv"\)'
  157. - 'ST1016: methods on the same type should have the same receiver name \(seen \d+x "srv", \d+x "[^"]+"\)'
  158. exclude-rules:
  159. # Exclude lll issues for long lines with go:generate
  160. - linters:
  161. - lll
  162. source: "^//go:generate "
  163. output:
  164. format: tab