.golangci.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. - gosec
  49. - asciicheck
  50. - prealloc
  51. - predeclared
  52. - makezero
  53. fast: false
  54. linters-settings:
  55. errcheck:
  56. # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
  57. # default is false: such cases aren't reported by default.
  58. check-type-assertions: false
  59. # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
  60. # default is false: such cases aren't reported by default.
  61. check-blank: false
  62. govet:
  63. # report about shadowed variables
  64. check-shadowing: false
  65. maligned:
  66. # print struct with more effective memory layout or not, false by default
  67. suggest-new: true
  68. misspell:
  69. # Correct spellings using locale preferences for US or UK.
  70. # Default is to use a neutral variety of English.
  71. # Setting locale to US will correct the British spelling of 'colour' to 'color'.
  72. locale: US
  73. ignore-words:
  74. - cancelled
  75. - marshalled
  76. lll:
  77. # max line length, lines longer will be reported. Default is 120.
  78. # '\t' is counted as 1 character by default, and can be changed with the tab-width option
  79. line-length: 160
  80. # tab width in spaces. Default to 1.
  81. tab-width: 1
  82. gocritic:
  83. disabled-checks:
  84. - exitAfterDefer
  85. unused:
  86. check-exported: false
  87. unparam:
  88. # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
  89. # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
  90. # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
  91. # with golangci-lint call it on a directory with the changed file.
  92. check-exported: false
  93. gci:
  94. sections:
  95. - standard
  96. - default
  97. - prefix(github.com/fatedier/frp/)
  98. gosec:
  99. severity: "low"
  100. confidence: "low"
  101. excludes:
  102. - G102
  103. - G112
  104. - G306
  105. - G401
  106. - G402
  107. - G404
  108. - G501
  109. issues:
  110. # List of regexps of issue texts to exclude, empty list by default.
  111. # But independently from this option we use default exclude patterns,
  112. # it can be disabled by `exclude-use-default: false`. To list all
  113. # excluded by default patterns execute `golangci-lint run --help`
  114. # exclude:
  115. # - composite literal uses unkeyed fields
  116. exclude-rules:
  117. # Exclude some linters from running on test files.
  118. - path: _test\.go$|^tests/|^samples/
  119. linters:
  120. - errcheck
  121. - maligned
  122. # Independently from option `exclude` we use default exclude patterns,
  123. # it can be disabled by this option. To list all
  124. # excluded by default patterns execute `golangci-lint run --help`.
  125. # Default value for this option is true.
  126. exclude-use-default: true
  127. # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  128. max-per-linter: 0
  129. # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  130. max-same-issues: 0