.golangci.yaml 2.1 KB

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