## Config for golangci-lint v2 schema
version: "2"

run:
  timeout: 3m

linters:
  default: none
  enable:
    ## enabled by default
    - errcheck
    - govet
    - ineffassign
    - staticcheck
    - unused
    ## disabled by default
    - asasalint
    - asciicheck
    - bidichk
    - bodyclose
    - canonicalheader
    - cyclop
    - dupl
    - durationcheck
    - errname
    - errorlint
    - exhaustive
    - fatcontext
    - forbidigo
    - funlen
    - gocheckcompilerdirectives
    #- gochecknoglobals
    #- gochecknoinits
    - gochecksumtype
    - gocognit
    - goconst
    - gocritic
    - gocyclo
    #- godot
    - gomoddirectives
    - gomodguard
    - goprintffuncname
    - gosec
    - intrange
    - lll
    - loggercheck
    - makezero
    - mirror
    #- mnd
    - musttag
    - nakedret
    - nestif
    - nilerr
    - nilnil
    - noctx
    - nolintlint
    - nonamedreturns
    - nosprintfhostport
    - perfsprint
    - predeclared
    - promlinter
    - protogetter
    - reassign
    - revive
    - rowserrcheck
    - sloglint
    - spancheck
    - sqlclosecheck
    - testableexamples
    #- testifylint
    - testpackage
    - tparallel
    - unconvert
    - unparam
    - usestdlibvars
    - usetesting
    - wastedassign
    - whitespace
  settings:
    cyclop:
      max-complexity: 30
      package-average: 10.0
    errcheck:
      check-type-assertions: true
    exhaustive:
      check:
        - switch
        - map
    exhaustruct:
      exclude:
        - "^net/http.Client$"
        - "^net/http.Cookie$"
        - "^net/http.Request$"
        - "^net/http.Response$"
        - "^net/http.Server$"
        - "^net/http.Transport$"
        - "^net/url.URL$"
        - "^os/exec.Cmd$"
        - "^reflect.StructField$"
        - "^github.com/Shopify/sarama.Config$"
        - "^github.com/Shopify/sarama.ProducerMessage$"
        - "^github.com/mitchellh/mapstructure.DecoderConfig$"
        - "^github.com/prometheus/client_golang/.+Opts$"
        - "^github.com/spf13/cobra.Command$"
        - "^github.com/spf13/cobra.CompletionOptions$"
        - "^github.com/stretchr/testify/mock.Mock$"
        - "^github.com/testcontainers/testcontainers-go.+Request$"
        - "^github.com/testcontainers/testcontainers-go.FromDockerfile$"
        - "^golang.org/x/tools/go/analysis.Analyzer$"
        - "^google.golang.org/protobuf/.+Options$"
        - "^gopkg.in/yaml.v3.Node$"
    funlen:
      lines: 100
      statements: 50
      ignore-comments: true
    gocognit:
      min-complexity: 20
    gocritic:
      settings:
        captLocal:
          paramsOnly: false
        underef:
          skipRecvDeref: false
    gomodguard:
      blocked:
        modules:
          - github.com/golang/protobuf:
              recommendations:
                - google.golang.org/protobuf
              reason: "see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules"
          - github.com/satori/go.uuid:
              recommendations:
                - github.com/google/uuid
              reason: "satori's package is not maintained"
          - github.com/gofrs/uuid:
              recommendations:
                - github.com/gofrs/uuid/v5
              reason: "gofrs' package was not go module before v5"
    govet:
      enable-all: true
      disable:
        - fieldalignment
      settings:
        shadow:
          strict: true
    inamedparam:
      skip-single-param: true
    mnd:
      ignored-functions:
        - args.Error
        - flag.Arg
        - flag.Duration.*
        - flag.Float.*
        - flag.Int.*
        - flag.Uint.*
        - os.Chmod
        - os.Mkdir.*
        - os.OpenFile
        - os.WriteFile
        - prometheus.ExponentialBuckets.*
        - prometheus.LinearBuckets
    nakedret:
      max-func-lines: 0
    nolintlint:
      allow-no-explanation:
        - funlen
        - gocognit
        - lll
      require-explanation: true
      require-specific: true
    perfsprint:
      strconcat: false
    rowserrcheck:
      packages:
        - github.com/jmoiron/sqlx
    sloglint:
      no-global: "all"
      context: "scope"
  exclusions:
    rules:
      - source: "(noinspection|TODO)"
        linters:
          - godot
      - source: "//noinspection"
        linters:
          - gocritic
      - path: "example\\.go"
        linters:
          - lll
      - path: "_test\\.go"
        linters:
          - bodyclose
          - dupl
          - funlen
          - goconst
          - gosec
          - noctx
          - wrapcheck
          - lll
          - testpackage

issues:
  max-same-issues: 50
