新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

.golangci.yml 3.32 KB

run:
  timeout: 10m
  tests: true
  # default is true. Enables skipping of directories:
  #   vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
  skip-dirs-use-default: true
  allow-parallel-runners: true
  show-stats: true
  #  skip-files:
  skip-dirs:
    - cert
    - chain
    - docker
    - etc
    - mock
    - pb
    - proto
    - scripts
    - sql
#    - test #from test

linters:
  disable-all: true
  enable:
    - deadcode
    - goconst
    - gocyclo
    - gofmt
    - ineffassign
    - staticcheck
    - structcheck # 当非导出结构嵌入另一个结构, 前一个结构被使用就不会监测到, 这个需要每个业务自己屏蔽
    - typecheck
    - goimports
    - revive
    - gosimple
    - govet
    - lll
    - rowserrcheck
    - errcheck
    - misspell
    - unused
#    - varcheck
    - sqlclosecheck
    - gosec


linters-settings:
  goconst:
    min-len: 2
    min-occurrences: 2
  gocyclo:
    min-complexity: 20
  goimports:
  #local-prefixes: git.code.oa.com
  golint:
  #min-confidence: 0
  govet:
    check-shadowing: true
  gosimple:
    go: "1.21"
  lll:
    line-length: 120
  errcheck:
    check-type-assertions: true
  gocritic:
    enabled-checks:
      - nestingReduce
    settings:
      nestingReduce:
        bodyWidth: 5
  revive:
    # see https://github.com/mgechev/revive#available-rules for details.
    rules:
      - name: blank-imports
      - name: context-as-argument
      - name: context-keys-type
      - name: dot-imports
      - name: error-return
      - name: error-strings
      - name: error-naming
      - name: exported
      - name: if-return
      - name: increment-decrement
#      - name: var-naming
      - name: var-declaration
      - name: package-comments
      - name: range
      - name: receiver-naming
      - name: time-naming
      - name: unexported-return
      - name: indent-error-flow
      - name: errorf
      - name: empty-block
      - name: superfluous-else
      - name: unexported-naming
      - name: unexported-return
      - name: unreachable-code
      - name: redefines-builtin-id
      - name: function-length
        arguments: [ 80,0 ]

issues:
  exclude-use-default: true
  include:
    - EXC0002 # golint (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
    - EXC0003 # golint func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
    #- EXC0004 # govet (possible misuse of unsafe.Pointer|should have signature)
    - EXC0005 # staticcheck ineffective break statement. Did you mean to break out of the outer loop
    - EXC0011 # stylecheck (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
    - RVV0001 # revive error codes

  exclude-rules:
    - path: .*_test.go
      linters:
        - unused
#        - deadcode
        - ineffassign
        - staticcheck
        - forbidigo
        - dupl
        - errcheck
        - lll
        - funlen
#    - path: test
#      linters:
#        - errcheck
#        - govet
#    - linters:
#        - revive
#      text: "stutters"
#    - linters:
#        - errcheck
#      text: "json.Unmarshal"
#    - linters:
#        - gosec
#      text: "G108|G204|G501|G401"
  max-same-issues: 0
  new: false
  max-issues-per-linter: 0

output:
  sort-results: true