version: "2"
linters:
  default: none
  enable:
    - asciicheck
    - copyloopvar
    - depguard
    - exhaustive
    - govet
    - ineffassign
    - misspell
    - prealloc
    - staticcheck
    - unconvert
    - unparam
    - unused
  settings:
    depguard:
      rules:
        random:
          deny:
            - pkg: "math/rand$"
              desc: use math/rand/v2
            - pkg: "golang.org/x/exp/rand"
              desc: use math/rand/v2
        quicvarint:
          list-mode: strict
          files:
            - '**/github.com/quic-go/quic-go/quicvarint/*'
            - '!$test'
          allow:
            - $gostd
        rsa:
          list-mode: original
          deny:
            - pkg: crypto/rsa
              desc: "use crypto/ed25519 instead"
    misspell:
      ignore-rules:
        - ect
  exclusions:
    generated: lax
    presets:
      - comments
      - common-false-positives
      - legacy
      - std-error-handling
    rules:
      - linters:
          - depguard
        path: internal/qtls
      - linters:
          - exhaustive
          - prealloc
          - unparam
        path: _test\.go
      - linters:
          - staticcheck
        path: _test\.go
        text: 'SA1029:' # inappropriate key in call to context.WithValue
      # WebTransport still relies on the ConnectionTracingID and ConnectionTracingKey.
      # See https://github.com/quic-go/quic-go/issues/4405 for more details.
      - linters:
          - staticcheck
        paths:
          - http3/
          - integrationtests/self/http_test.go
        text: 'SA1019:.+quic\.ConnectionTracing(ID|Key)'
    paths:
      - internal/handshake/cipher_suite.go
      - third_party$
      - builtin$
      - examples$
formatters:
  enable:
    - gofmt
    - gofumpt
    - goimports
  exclusions:
    generated: lax
    paths:
      - internal/handshake/cipher_suite.go
      - third_party$
      - builtin$
      - examples$
