version: "2"
issues:
  max-same-issues: 0

linters:
  enable:
    - copyloopvar
    - depguard
    - durationcheck
    - errorlint
    - misspell
    - nolintlint
    - perfsprint
    - predeclared
    - revive
    - unconvert
    - usestdlibvars
    - wastedassign
  exclusions:
      generated: lax
      presets:
        - comments
        - common-false-positives
        - legacy
        - std-error-handling
      rules:
        - linters:
            - errcheck
            - govet
            - structcheck
            - nolintlint
          path: _test.go
      paths:
        - ^.*\.(pb|y)\.go$
        - third_party$
        - builtin$
        - examples$
  settings:
    depguard:
      rules:
        main:
          deny:
            - pkg: github.com/stretchr/testify/assert
              desc: Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert
            - pkg: github.com/go-kit/kit/log
              desc: Use github.com/go-kit/log instead of github.com/go-kit/kit/log
            - pkg: io/ioutil
              desc: Use corresponding 'os' or 'io' functions instead.
    errcheck:
      exclude-functions:
        # The following 2 methods always return nil as the error
        - (*github.com/cespare/xxhash/v2.Digest).Write
        - (*github.com/cespare/xxhash/v2.Digest).WriteString
        - (*bufio.Writer).WriteRune
    perfsprint:
      # Optimizes even if it requires an int or uint type cast.
      int-conversion: true
      # Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.
      err-error: true
      # Optimizes `fmt.Errorf`.
      errorf: true
      # Optimizes `fmt.Sprintf` with only one argument.
      sprintf1: true
      # Optimizes into strings concatenation.
      strconcat: true
    revive:
      rules:

        - name: unused-parameter
          severity: warning
          disabled: true

formatters:
  enable:
    - gofmt
    - gofumpt
    - goimports
  settings:
    gofumpt:
      extra-rules: true
    goimports:
      local-prefixes:
        - github.com/prometheus/client_golang
  exclusions:
    generated: lax
    paths:
      - ^.*\.(pb|y)\.go$
      - third_party$
      - builtin$
      - examples$
