.golangci.yaml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. run:
  2. timeout: 10m
  3. linters:
  4. enable:
  5. - errcheck
  6. - goimports
  7. - revive
  8. - govet
  9. - staticcheck
  10. - misspell
  11. - gocritic
  12. - sqlclosecheck
  13. - rowserrcheck
  14. - nilerr
  15. - godot
  16. - forbidigo
  17. - mirror
  18. - bodyclose
  19. issues:
  20. include:
  21. # https://golangci-lint.run/usage/configuration/#command-line-options
  22. exclude:
  23. - Rollback
  24. - logger.Sync
  25. - pgInstance.Stop
  26. - fmt.Printf
  27. - Enter(.*)_(.*)
  28. - Exit(.*)_(.*)
  29. linters-settings:
  30. goimports:
  31. # Put imports beginning with prefix after 3rd-party packages.
  32. local-prefixes: github.com/usememos/memos
  33. revive:
  34. # Default to run all linters so that new rules in the future could automatically be added to the static check.
  35. enable-all-rules: true
  36. rules:
  37. # The following rules are too strict and make coding harder. We do not enable them for now.
  38. - name: file-header
  39. disabled: true
  40. - name: line-length-limit
  41. disabled: true
  42. - name: function-length
  43. disabled: true
  44. - name: max-public-structs
  45. disabled: true
  46. - name: function-result-limit
  47. disabled: true
  48. - name: banned-characters
  49. disabled: true
  50. - name: argument-limit
  51. disabled: true
  52. - name: cognitive-complexity
  53. disabled: true
  54. - name: cyclomatic
  55. disabled: true
  56. - name: confusing-results
  57. disabled: true
  58. - name: add-constant
  59. disabled: true
  60. - name: flag-parameter
  61. disabled: true
  62. - name: nested-structs
  63. disabled: true
  64. - name: import-shadowing
  65. disabled: true
  66. - name: early-return
  67. disabled: true
  68. - name: use-any
  69. disabled: true
  70. - name: exported
  71. disabled: true
  72. - name: unhandled-error
  73. disabled: true
  74. gocritic:
  75. disabled-checks:
  76. - ifElseChain
  77. govet:
  78. settings:
  79. printf: # The name of the analyzer, run `go tool vet help` to see the list of all analyzers
  80. funcs: # Run `go tool vet help printf` to see the full configuration of `printf`.
  81. - common.Errorf
  82. enable-all: true
  83. disable:
  84. - fieldalignment
  85. - shadow
  86. forbidigo:
  87. forbid:
  88. - 'fmt\.Errorf(# Please use errors\.Wrap\|Wrapf\|Errorf instead)?'
  89. - 'ioutil\.ReadDir(# Please use os\.ReadDir)?'