version: "2"
run:
  go: "1.26"
  issues-exit-code: 1
  tests: true
output:
  formats:
    text:
      path: stdout
      print-linter-name: true
      print-issued-lines: true
linters:
  enable:
    - asasalint
    - asciicheck
    - bidichk
    - bodyclose
    - contextcheck
    - dupl
    - durationcheck
    - errchkjson
    - errorlint
    - exhaustive
    - fatcontext
    - gocheckcompilerdirectives
    - gochecksumtype
    - goconst
    - gocritic
    - gosmopolitan
    - lll
    - loggercheck
    - makezero
    - misspell
    - mnd
    - musttag
    - nilerr
    - nilnesserr
    - noctx
    - paralleltest
    - perfsprint
    - prealloc
    - protogetter
    - reassign
    - rowserrcheck
    - spancheck
    - sqlclosecheck
    - staticcheck
    - testableexamples
    - testifylint
    - testpackage
    - thelper
    - tparallel
    - unconvert
    - unparam
    - usetesting
    - wastedassign
    - wsl_v5
    - zerologlint
  settings:
    dupl:
      threshold: 120
    errcheck:
      check-type-assertions: false
      check-blank: false
      exclude-functions:
        - (*os.File).Close
    errorlint:
      errorf: true
      asserts: true
      comparison: true
    goconst:
      min-len: 3
      min-occurrences: 5
    gocritic:
      enabled-tags:
        - performance
      disabled-tags:
        - experimental
    govet:
      enable:
        - fieldalignment
        - printf
        - unusedwrite
    nakedret:
      max-func-lines: 20
    staticcheck:
      checks:
        - all
        - -SA9005
        - -QF1008
        - -ST1001
    unparam:
      check-exported: false
    wsl_v5:
      allow-whole-block: false
      branch-max-lines: 2
  exclusions:
    generated: lax
    rules:
      - linters:
          - dupl
          - errcheck
          - gocyclo
          - mnd
          - unparam
          - wsl
        path: _test\.go
      # We end up with duplicated content in this package to save us from duplicating code in other packages.
      - linters:
          - dupl
        path: cli/flags/shared
      # BubbleTea's tea.Model expects value-receiver methods (Init/Update/View),
      # so Model and WelcomeModel in the TUI packages trip gocritic's hugeParam
      # check. Silence it for these packages only; hugeParam still runs everywhere else.
      - linters:
          - gocritic
        text: "hugeParam:"
        path: internal/cli/commands/catalog/tui/
      # Incrementally linting lines that are too long to ensure that
      # we don't have conflicts on every file in the codebase while
      # trying to get this merged in.
      - linters:
          - lll
        path-except: '^(internal/awshelper/|internal/cas/|internal/cli/commands/(backend/(delete|migrate)|catalog/tui/command|exec|find|help|list|stack)/|internal/cloner/|internal/configbridge/|internal/engine/|internal/errorconfig/|internal/errors/|internal/experiment/|internal/gcphelper/|internal/git/|internal/os/exec/|internal/prepare/|internal/queue/|internal/runner/(common|graph|run/creds)/|internal/stacks/(generate|output)/|internal/tf/cache/(controllers|middleware)/|internal/tflint/|internal/tips/|internal/vfs/|internal/worktrees/|pkg/log/(format/placeholders|writer)/)'
    paths:
      - docs
      - _ci
      - .github
      - .circleci
      - third_party$
      - builtin$
      - examples$
issues:
  max-issues-per-linter: 0
  max-same-issues: 0
formatters:
  enable:
    - goimports
  settings:
    gofmt:
      simplify: true
  exclusions:
    generated: lax
    paths:
      - docs
      - _ci
      - .github
      - .circleci
      - third_party$
      - builtin$
      - examples$
