.golangci.yaml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. - name: if-return
  75. disabled: true
  76. gocritic:
  77. disabled-checks:
  78. - ifElseChain
  79. govet:
  80. settings:
  81. printf: # The name of the analyzer, run `go tool vet help` to see the list of all analyzers
  82. funcs: # Run `go tool vet help printf` to see the full configuration of `printf`.
  83. - common.Errorf
  84. enable-all: true
  85. disable:
  86. - fieldalignment
  87. - shadow
  88. forbidigo:
  89. forbid:
  90. - 'fmt\.Errorf(# Please use errors\.Wrap\|Wrapf\|Errorf instead)?'
  91. - 'ioutil\.ReadDir(# Please use os\.ReadDir)?'