.golangci.yml 4.2 KB

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