run:
  timeout: 5m
  tests: true
  modules-download-mode: readonly

linters-settings:
  errcheck:
    check-type-assertions: false
    check-blank: false
    exclude-functions:
      - (io.Closer).Close
      - (*github.com/spf13/pflag.FlagSet).GetString
      - (*github.com/spf13/pflag.FlagSet).GetInt
      - (*github.com/spf13/pflag.FlagSet).GetBool
      - (github.com/spf13/viper).BindPFlag
      - (*github.com/spf13/cobra.Command).MarkFlagRequired
      - (*github.com/spf13/cobra.Command).RegisterFlagCompletionFunc

  gocyclo:
    min-complexity: 30

  funlen:
    lines: 100
    statements: 60

  govet:
    enable-all: false
    enable:
      - assign
      - atomic
      - bools
      - buildtag
      - copylocks
      - httpresponse
      - loopclosure
      - lostcancel
      - nilfunc
      - printf
      - shadow
      - shift
      - unreachable
      - unusedresult

  misspell:
    locale: US

  staticcheck:
    checks: ["all", "-SA4003"]

  lll:
    line-length: 140

  goconst:
    min-len: 3
    min-occurrences: 5

  revive:
    rules:
      - name: var-naming
        disabled: true
      - name: unused-parameter
        disabled: true
      - name: redefines-builtin-id
        disabled: true

  gosec:
    excludes:
      - G115  # integer overflow conversion - we handle this safely
      - G306  # WriteFile permissions - public output files are fine

linters:
  enable:
    - bodyclose
    - dogsled
    - errcheck
    - goconst
    - gocritic
    - gocyclo
    - gofmt
    - goimports
    - gosec
    - gosimple
    - govet
    - ineffassign
    - misspell
    - nakedret
    - noctx
    - nolintlint
    - revive
    - staticcheck
    - typecheck
    - unconvert
    - unparam
    - unused
    - whitespace

  disable:
    - depguard
    - funlen
    - gochecknoinits
    - lll
    - prealloc

issues:
  exclude-rules:
    - path: _test\.go
      linters:
        - gocyclo
        - errcheck
        - dupl
        - gosec
        - funlen
        - goconst

    - path: cmd/
      linters:
        - gochecknoinits

    - text: "weak cryptographic primitive"
      linters:
        - gosec

    - path: example_
      linters:
        - lll

    # Allow unlambda in cobra command setup
    - text: "unlambda"
      linters:
        - gocritic

    # Allow if-else chains in complex validation logic
    - text: "ifElseChain"
      linters:
        - gocritic

    # Allow elseif suggestions
    - text: "elseif"
      linters:
        - gocritic

    # Exclude appendAssign in specific cases
    - text: "appendAssign"
      linters:
        - gocritic

    # Allow assignOp suggestions
    - text: "assignOp"
      linters:
        - gocritic

  max-issues-per-linter: 0
  max-same-issues: 0
