version: "2"

formatters:
  enable:
    - gci
    - gofumpt
    - goimports
  exclusions:
    generated: lax
    paths:
      - third_party$
      - builtin$
      - examples$

linters:
  settings:
    misspell:
      locale: US
    goconst:
      ignore-string-values:
        # commonly used settings strings
        - "^disabled$"
        # Firewall and routing strings
        - "^(ACCEPT|DROP)$"
        - "^--delete$"
        - "^all$"
        - "^(tcp|udp)$"
        # Server route strings
        - "^/status$"

  exclusions:
    generated: lax
    presets:
      - comments
      - common-false-positives
      - legacy
      - std-error-handling
    rules:
      - linters:
          - containedctx
          - dupl
          - err113
          - maintidx
        path: _test\.go
      - linters:
          - dupl
        path: internal\/server\/.+\.go
      - linters:
          - ireturn
        text: returns interface \(github\.com\/vishvananda\/netlink\.Link\)
      - linters:
          - ireturn
        path: internal\/openvpn\/pkcs8\/descbc\.go
        text: newCipherDESCBCBlock returns interface \(github\.com\/youmark\/pkcs8\.Cipher\)
      - linters:
          - revive
        path: internal\/provider\/(common|utils)\/.+\.go
        text: "var-naming: avoid (bad|meaningless) package names"
      - linters:
          - err113
          - mnd
        path: ci\/.+\.go

    paths:
      - third_party$
      - builtin$
      - examples$
  enable:
    # - cyclop
    # - errorlint
    - asasalint
    - asciicheck
    - bidichk
    - bodyclose
    - containedctx
    - copyloopvar
    - decorder
    - dogsled
    - dupl
    - dupword
    - durationcheck
    - err113
    - errchkjson
    - errname
    - exhaustive
    - fatcontext
    - forcetypeassert
    - gocheckcompilerdirectives
    - gochecknoglobals
    - gochecknoinits
    - gocognit
    - goconst
    - gocritic
    - gocyclo
    - godot
    - goheader
    - gomoddirectives
    - goprintffuncname
    - gosec
    - gosmopolitan
    - grouper
    - importas
    - interfacebloat
    - intrange
    - ireturn
    - lll
    - maintidx
    - makezero
    - mirror
    - misspell
    - mnd
    - musttag
    - nakedret
    - nestif
    - nilerr
    - nilnil
    - noctx
    - nolintlint
    - nosprintfhostport
    - paralleltest
    - prealloc
    - predeclared
    - promlinter
    - reassign
    - revive
    - rowserrcheck
    - sqlclosecheck
    - tagalign
    - thelper
    - tparallel
    - unconvert
    - unparam
    - usestdlibvars
    - wastedassign
    - whitespace
    - zerologlint
