.golangci.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. service:
  2. # When updating this, also update the version stored in docker/build-tools/Dockerfile in the istio/tools repo.
  3. golangci-lint-version: 1.49.x # use the fixed version to not introduce new linters unexpectedly
  4. run:
  5. concurrency: 4
  6. # timeout for analysis, e.g. 30s, 5m, default is 1m
  7. deadline: 20m
  8. build-tags:
  9. - integ
  10. - integfuzz
  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. - genfiles$
  18. - vendor$
  19. - bin$
  20. # which files to skip: they will be analyzed, but issues from them
  21. # won't be reported. Default value is empty list, but there is
  22. # no need to include all autogenerated files, we confidently recognize
  23. # autogenerated files. If it's not please let us know.
  24. skip-files:
  25. - ".*\\.pb\\.go"
  26. - ".*\\.gen\\.go"
  27. linters:
  28. disable-all: true
  29. enable:
  30. - unused
  31. - errcheck
  32. - exportloopref
  33. - gocritic
  34. - gofumpt
  35. - goimports
  36. - revive
  37. - gosimple
  38. - govet
  39. - ineffassign
  40. - lll
  41. - misspell
  42. - staticcheck
  43. - stylecheck
  44. - typecheck
  45. - unconvert
  46. - unparam
  47. - gci
  48. - bodyclose
  49. - gosec
  50. - asciicheck
  51. - prealloc
  52. - predeclared
  53. - makezero
  54. fast: false
  55. linters-settings:
  56. errcheck:
  57. # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
  58. # default is false: such cases aren't reported by default.
  59. check-type-assertions: false
  60. # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
  61. # default is false: such cases aren't reported by default.
  62. check-blank: false
  63. govet:
  64. # report about shadowed variables
  65. check-shadowing: false
  66. maligned:
  67. # print struct with more effective memory layout or not, false by default
  68. suggest-new: true
  69. misspell:
  70. # Correct spellings using locale preferences for US or UK.
  71. # Default is to use a neutral variety of English.
  72. # Setting locale to US will correct the British spelling of 'colour' to 'color'.
  73. locale: US
  74. ignore-words:
  75. - cancelled
  76. - marshalled
  77. lll:
  78. # max line length, lines longer will be reported. Default is 120.
  79. # '\t' is counted as 1 character by default, and can be changed with the tab-width option
  80. line-length: 160
  81. # tab width in spaces. Default to 1.
  82. tab-width: 1
  83. gocritic:
  84. disabled-checks:
  85. - exitAfterDefer
  86. unused:
  87. check-exported: false
  88. unparam:
  89. # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
  90. # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
  91. # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
  92. # with golangci-lint call it on a directory with the changed file.
  93. check-exported: false
  94. gci:
  95. sections:
  96. - standard
  97. - default
  98. - prefix(github.com/fatedier/frp/)
  99. gosec:
  100. severity: "low"
  101. confidence: "low"
  102. excludes:
  103. - G102
  104. - G112
  105. - G306
  106. - G401
  107. - G402
  108. - G404
  109. - G501
  110. issues:
  111. # List of regexps of issue texts to exclude, empty list by default.
  112. # But independently from this option we use default exclude patterns,
  113. # it can be disabled by `exclude-use-default: false`. To list all
  114. # excluded by default patterns execute `golangci-lint run --help`
  115. # exclude:
  116. # - composite literal uses unkeyed fields
  117. exclude-rules:
  118. # Exclude some linters from running on test files.
  119. - path: _test\.go$|^tests/|^samples/
  120. linters:
  121. - errcheck
  122. - maligned
  123. # Independently from option `exclude` we use default exclude patterns,
  124. # it can be disabled by this option. To list all
  125. # excluded by default patterns execute `golangci-lint run --help`.
  126. # Default value for this option is true.
  127. exclude-use-default: true
  128. # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  129. max-per-linter: 0
  130. # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  131. max-same-issues: 0