version: "2"
run:
  build-tags:
    - e2e
    - ledger
    - test_ledger_mock
    - sims
  tests: true
  allow-parallel-runners: true
linters:
  default: none
  enable:
    - copyloopvar
    - dogsled
    - errcheck
    - errorlint
    - gocritic
    - gosec
    - govet
    - ineffassign
    - misspell
    - nakedret
    - nolintlint
    - revive
    - staticcheck
    - thelper
    - unconvert
    - unused
  settings:
    dogsled:
      max-blank-identifiers: 6
    gocritic:
      disabled-checks:
        - regexpMust
        - appendAssign
        - ifElseChain
    gosec:
      excludes:
        - G101
        - G107
        - G118
        -
        - G404
        - G602  # slice index out of range - safe in context
        - G702  # command injection via taint analysis - safe in context
        - G703  # path traversal via taint analysis - safe in context
        - G704  # SSRF via taint analysis - safe in context
        - G705  # XSS via taint analysis - safe in context
        - G117  # exported struct field matches secret pattern - safe in context
      confidence: medium
    misspell:
      locale: US
    nolintlint:
      require-explanation: true
      require-specific: false
      allow-unused: false
    revive:
      rules:
        - name: redefines-builtin-id
          disabled: true
        - name: exported
          severity: error
          disabled: false
    staticcheck:
      checks:
        - all
    unused:
      local-variables-are-used: false
  exclusions:
    generated: lax
    presets:
      - common-false-positives
      - legacy
      - std-error-handling
    rules:
      - linters:
          - staticcheck
        text: "ST1000:"
      - linters:
          - revive
        text: "or be unexported" # don't report types that have no comments at all. there are way too many of these.
      - linters:
          - staticcheck
        text: "ST1003:"
      - linters:
          - staticcheck
        text: "ST1016:"
      - linters:
          - staticcheck
        path: migrations
        text: "SA1019:"
      - linters:
          - staticcheck
        text: "SA1019: codec.NewAminoCodec is deprecated"
      - linters:
          - staticcheck
        text: "SA1019: legacybech32.MustMarshalPubKey"
      - linters:
          - staticcheck
        text: "SA1019: legacybech32.MarshalPubKey"
      - linters:
          - staticcheck
        text: "SA1019: legacybech32.UnmarshalPubKey"
      - linters:
          - staticcheck
        text: "SA1019: params.SendEnabled is deprecated"
      - linters:
          - gosec
        text: "G115: integer overflow conversion"
      - linters:
          - govet
        text: "Constant reflect.Ptr should be inlined"
      - linters:
          - nolintlint
        text: leading space
    paths:
      - server/grpc/gogoreflection/fix_registration.go
      - fix_registration.go
      - .*\.pb\.go$
      - .*\.pb\.gw\.go$
      - .*\.pulsar\.go$
      - crypto/keys/secp256k1/internal/*
      - types/coin_regex.go
      - testutil/testdata
      - contrib
      - third_party$
      - builtin$
      - examples$
issues:
  max-issues-per-linter: 10000
  max-same-issues: 10000
formatters:
  enable:
    - gci
    - gofumpt
  settings:
    gci:
      sections:
        - standard
        - default
        - prefix(cosmossdk.io)
        - prefix(github.com/cosmos/cosmos-sdk)
      custom-order: true
    gofumpt:
      extra-rules: true
  exclusions:
    generated: lax
    paths:
      - server/grpc/gogoreflection/fix_registration.go
      - fix_registration.go
      - .*\.pb\.go$
      - .*\.pb\.gw\.go$
      - .*\.pulsar\.go$
      - crypto/keys/secp256k1/internal/*
      - types/coin_regex.go
      - testutil/testdata
      - contrib
      - third_party$
      - builtin$
      - examples$
