golangci-lint.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. linters:
  2. enable:
  3. - deadcode
  4. - depguard
  5. - goimports
  6. - golint
  7. - gosec
  8. - gosimple
  9. - govet
  10. - ineffassign
  11. - misspell
  12. - staticcheck
  13. - structcheck
  14. - typecheck
  15. - unconvert
  16. - unused
  17. - varcheck
  18. disable:
  19. - errcheck
  20. run:
  21. concurrency: 2
  22. modules-download-mode: vendor
  23. skip-dirs:
  24. - docs
  25. linters-settings:
  26. govet:
  27. check-shadowing: false
  28. depguard:
  29. list-type: blacklist
  30. include-go-root: true
  31. packages:
  32. # The io/ioutil package has been deprecated.
  33. # https://go.dev/doc/go1.16#ioutil
  34. - io/ioutil
  35. issues:
  36. # The default exclusion rules are a bit too permissive, so copying the relevant ones below
  37. exclude-use-default: false
  38. exclude-rules:
  39. # These are copied from the default exclude rules, except for "ineffective break statement"
  40. # and GoDoc checks.
  41. # https://github.com/golangci/golangci-lint/blob/0cc87df732aaf1d5ad9ce9ca538d38d916918b36/pkg/config/config.go#L36
  42. - text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked"
  43. linters:
  44. - errcheck
  45. - text: "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this"
  46. linters:
  47. - golint
  48. - text: "G103: Use of unsafe calls should be audited"
  49. linters:
  50. - gosec
  51. - text: "G104: Errors unhandled"
  52. linters:
  53. - gosec
  54. - text: "G204: Subprocess launch(ed with (variable|function call)|ing should be audited)"
  55. linters:
  56. - gosec
  57. - text: "(G301|G302): (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)"
  58. linters:
  59. - gosec
  60. - text: "G304: Potential file inclusion via variable"
  61. linters:
  62. - gosec
  63. - text: "G306: Expect WriteFile permissions to be 0600 or less"
  64. linters:
  65. - gosec
  66. - text: 'G307: Deferring unsafe method "Close" on type "*os.File"'
  67. linters: gosec
  68. # Exclude some linters from running on tests files.
  69. - path: _test\.go
  70. linters:
  71. - errcheck
  72. - gosec
  73. # Suppress golint complaining about generated types in api/types/
  74. - text: "type name will be used as (container|volume)\\.(Container|Volume).* by other packages, and that stutters; consider calling this"
  75. path: "api/types/(volume|container)/"
  76. linters:
  77. - golint
  78. # FIXME: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close" (gosec)
  79. - text: "G307: Deferring unsafe method"
  80. linters:
  81. - gosec
  82. # FIXME temporarily suppress these. See #39924
  83. - text: "SA1019: .*\\.Xattrs is deprecated: Use PAXRecords instead"
  84. linters:
  85. - staticcheck
  86. # FIXME temporarily suppress these. See #39926
  87. - text: "SA1019: httputil.NewClientConn"
  88. linters:
  89. - staticcheck
  90. # FIXME temporarily suppress these (related to the ones above)
  91. - text: "SA1019: httputil.ErrPersistEOF"
  92. linters:
  93. - staticcheck
  94. # This code is doing some fun stuff with reflect and it trips up the linter.
  95. - text: "field `foo` is unused"
  96. path: "libnetwork/options/options_test.go"
  97. linters:
  98. - structcheck
  99. - unused
  100. # This field is only used on windows but is defined in a platform agnostic file.
  101. # The linter doesn't understand that the field is used.
  102. - text: "`resolverOnce` is unused"
  103. path: libnetwork/network.go
  104. linters:
  105. - structcheck
  106. - unused
  107. # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  108. max-issues-per-linter: 0
  109. # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  110. max-same-issues: 0