linters:
  enable:
  - asciicheck
  - bidichk
  - bodyclose
  - contextcheck
  - deadcode
  - decorder
  - depguard
  - dogsled
  - dupl
  - durationcheck
  - errcheck
  - errchkjson
  - errname
  - errorlint
  - exportloopref
  - forbidigo
  - forcetypeassert
  - gci
  - gocritic
  - godot
  - goerr113
  - gofmt
  - gofumpt
  - goimports
  - gomoddirectives
  - gomodguard
  - goprintffuncname
  - gosec
  - gosimple
  - govet
  - ifshort
  - importas
  - ineffassign
  - ireturn
  - lll
  - makezero
  - misspell
  - nilerr
  - noctx
  - nolintlint
  - prealloc
  - predeclared
  - promlinter
  - revive
  - rowserrcheck
  - sqlclosecheck
  - staticcheck
  - structcheck
  - stylecheck
  - tagliatelle
  - tenv
  - thelper
  - typecheck
  - unconvert
  - unparam
  - unused
  - varcheck
  - wastedassign
  - whitespace
  disable:
  - cyclop
  - exhaustive
  - exhaustivestruct
  - funlen
  - gochecknoglobals
  - gochecknoinits
  - gocognit
  - goconst
  - gocyclo
  - godox
  - goheader
  - gomnd
  - maintidx
  - maligned
  - nakedret
  - nestif
  - nilnil
  - nlreturn
  - paralleltest
  - testpackage
  - tparallel
  - varnamelen
  - wrapcheck
  - wsl

linters-settings:
  forbidigo:
    forbid:
    - ^fmt\.Print.*$
    - ^ioutil\..*$
    - ^os\.(DirEntry|FileInfo|FileMode|Is.*|Mode.*)$
  gci:
    sections:
    - standard
    - default
    - prefix(github.com/twpayne/chezmoi)
  gofumpt:
    extra-rules: true
  goimports:
    local-prefixes: github.com/twpayne/chezmoi
  ireturn:
    allow:
    - anon
    - empty
    - error
    - github.com/go-git/go-git/v5/plumbing/format/diff\.File
    - github.com/go-git/go-git/v5/plumbing/format/diff\.Patch
    - github.com/mitchellh/mapstructure\.DecodeHookFunc
    - github.com/twpayne/chezmoi/v2/pkg/chezmoi\.ActualStateEntry
    - github.com/twpayne/chezmoi/v2/pkg/chezmoi\.Encryption
    - github.com/twpayne/chezmoi/v2/pkg/chezmoi\.SourceStateEntry
    - github.com/twpayne/chezmoi/v2/pkg/chezmoi\.TargetStateEntry
    - github.com/twpayne/go-vfs/v4\.FS
    - stdlib
  misspell:
    locale: US

issues:
  exclude-rules:
  - linters:
    - goerr113
    text: "do not define dynamic errors, use wrapped static errors instead"
  - linters:
    - forbidigo
    - gosec
    - lll
    path: ^internal/cmds/
  - linters:
    - gosec
    - lll
    path: "_test\\.go$"
