run:
  timeout: 10m
  build-tags:
    - nosqlite
    - noboltdb
    - integration

linters:
  presets:
    - bugs
    - error
    - unused
    - performance
  disable:
    - gosec
    - exhaustive
    - musttag
    - contextcheck
    - wrapcheck
    - err113
    - unparam
    - makezero #TODO: enable me
    - noctx #TODO: enable me
    - nilerr #TODO: enable me
    - errorlint #TODO: enable me
    - errchkjson #TODO: enable me
    - unused #TODO: enable me
    - testifylint #TODO: enable me
    - gocheckcompilerdirectives
    - protogetter
  enable:
    - unconvert
    #    - predeclared #TODO: enable me
    #    - thelper #TODO: enable me
    - wastedassign
    - gofmt
    - gocritic
    - perfsprint
#    - revive
#    - forcetypeassert
#    - stylecheck

linters-settings:
  gocritic: # see https://golangci-lint.run/usage/linters/#gocritic and https://go-critic.github.io/overview#checks-overview
    enabled-tags:
      - performance
      - diagnostic
    enabled-checks:
      - ruleguard
    disabled-checks:
      - regexpMust
      - appendAssign
      - rangeValCopy
      - exitAfterDefer
      - elseif
      - dupBranchBody
      - assignOp
      - singleCaseSwitch
      - unlambda
      - captLocal
      - commentFormatting
      - ifElseChain

      # diagnostigs tag: possible bugs. need enable checks in future
      - sloppyReassign
      - sprintfQuotedString
      - deferInLoop
      - nilValReturn
      - evalOrder
      - returnAfterHttpError
      - weakCond
      - builtinShadowDecl
      - unnecessaryDefer
      - uncheckedInlineErr
      - preferStringWriter
      - commentedOutCode
      - preferFprint

    settings:
      ruleguard:
        rules: "rules.go"
      hugeParam:
        # size in bytes that makes the warning trigger (default 80)
        sizeThreshold: 1000
      rangeExprCopy:
        # size in bytes that makes the warning trigger (default 512)
        sizeThreshold: 512
        # whether to check test functions (default true)
        skipTestFuncs: true
      underef:
        # whether to skip (*x).method() calls where x is a pointer receiver (default true)
        skipRecvDeref: true

  govet:
    disable:
      - deepequalerrors
      - fieldalignment
      - shadow
      - unsafeptr
  goconst:
    min-len: 2
    min-occurrences: 2
  gofmt:
    simplify: false

issues:
  exclude-rules:
    - linters:
        - golint
      text: "should be"
    - linters:
        - errcheck
      text: "not checked"
    - linters:
        - staticcheck
      text: "SA(1019|1029|5011)"
    # Exclude some linters from running on tests files.
    - path: test\.go
      linters:
        - gosec
        - unused
        - gocritic
        - perfsprint
    - path: hack\.go
      linters:
        - gosec
        - unused
        - gocritic
    - path: cmd/devp2p
      linters:
        - gosec
        - unused
        - gocritic
    - path: metrics/sample\.go
      linters:
        - gosec
        - gocritic
    - path: p2p/simulations
      linters:
        - gosec
        - gocritic
    - path: p2p/dnsdisc
      linters:
        - gosec
        - gocritic
