version: "2"
run:
  timeout: 50m
linters:
  default: none
  enable:
    - errcheck
    - errorlint
    - gocritic
    - govet
    - ineffassign
    - misspell
    - perfsprint
    - staticcheck
    - testifylint
    - thelper
    - unparam
    - unused
    - usestdlibvars
    - whitespace
  settings:
    gocritic:
      disabled-checks:
        - appendAssign
        - assignOp
        - badCond
        - commentFormatting
        - exitAfterDefer
        - ifElseChain
        - mapKey
        - singleCaseSwitch
        - typeSwitchVar
    perfsprint:
      int-conversion: true
      err-error: false
      errorf: false
      sprintf1: true
      strconcat: false
    staticcheck:
      checks:
        - "all"
        - "-ST1001" # dot imports are discouraged
        - "-ST1003" # poorly chosen identifier
        - "-ST1005" # incorrectly formatted error string
        - "-ST1011" # poorly chosen name for variable of type time.Duration
        - "-ST1012" # poorly chosen name for an error variable
        - "-ST1016" # use consistent method receiver names
        - "-ST1017" # don't use Yoda conditions
        - "-ST1019" # importing the same package multiple times
        - "-ST1023" # redundant type in variable declaration
        - "-QF1001" # apply De Morgan’s law
        - "-QF1003" # convert if/else-if chain to tagged switch
        - "-QF1006" # lift if+break into loop condition
        - "-QF1007" # merge conditional assignment into variable declaration
        - "-QF1008" # omit embedded fields from selector expression
        - "-QF1009" # use time.Time.Equal instead of == operator
        - "-QF1011" # omit redundant type from variable declaration
        - "-QF1012" # use fmt.Fprintf(x, ...) instead of x.Write(fmt.Sprintf(...))
    testifylint:
      enable-all: true
      disable:
        - go-require
        - equal-values
        - empty
        - len
        - expected-actual
        - formatter
  exclusions:
    generated: lax
    presets:
      - comments
      - common-false-positives
      - legacy
      - std-error-handling
    rules:
      - linters:
          - unparam
        path: (.+)_test\.go
      - path: (.+)\.go$
        text: SA5011
    paths:
      - third_party$
      - builtin$
      - examples$
issues:
  max-issues-per-linter: 0
  max-same-issues: 0
formatters:
  enable:
    - gofumpt
    - goimports
  settings:
    goimports:
      local-prefixes:
        - github.com/argoproj/argo-cd/v2
  exclusions:
    generated: lax
    paths:
      - third_party$
      - builtin$
      - examples$
