version: "2"

run:
  timeout: 5m
  issues-exit-code: 1
  tests: true

output:
  formats:
    text:
      path: stdout
      print-linter-name: true

linters:
  default: all
  disable:
    # 合理禁用 - 项目有中文注释/标识符
    - asciicheck
    - gosmopolitan

    # 风格限制 - 可接受的灵活性
    - funlen
    - gocyclo
    - cyclop
    - lll
    - varnamelen
    - tagalign
    - nlreturn
    - wsl
    - nestif

    # 重复/噪音
    - dupl
    - dupword
    - misspell

    # 注释风格
    - godot
    - godox
    - goheader

    # 测试相关 - 不强制
    - paralleltest
    - tparallel
    - testpackage
    - testifylint
    - testableexamples
    - thelper

    # 框架/工具特定 - 项目不使用
    - ginkgolinter
    - promlinter
    - protogetter
    - spancheck
    - zerologlint

    # 声明/结构风格
    - decorder
    - exhaustruct
    - iface

    # 命名风格
    - errname
    - inamedparam
    - nonamedreturns

    # 不适用的检查
    - bidichk
    - rowserrcheck
    - sqlclosecheck

    # 可配置而非禁用
    - forbidigo
    - depguard
    - gomodguard
    - gomoddirectives
    - importas

    # 复杂度度量
    - gocognit
    - maintidx

    # 噪音/风格 - 已有惯例
    - dogsled
    - nosprintfhostport
    - goprintffuncname
    - tagliatelle
    - usestdlibvars
    - usetesting
    - unparam
    - mnd
    - ireturn
    - nakedret
    - interfacebloat
    - gocritic
    - gosec

    # 项目特定豁免
    - asasalint
    - containedctx
    - err113
    - forcetypeassert
    - gochecknoglobals
    - gochecknoinits
    - nilerr
    - nilnil
    - musttag
    - noctx
    - intrange
    - reassign
    - perfsprint
    - wastedassign
    - wrapcheck
    - errchkjson

    # 额外禁用
    - bodyclose
    - contextcheck
    - errorlint
    - canonicalheader
    - copyloopvar
    - durationcheck
    - exptostd
    - fatcontext
    - gochecksumtype
    - grouper
    - loggercheck
    - makezero
    - mirror
    - nilnesserr
    - predeclared
    - recvcheck
    - sloglint
    - unconvert
    - whitespace
    # v2 新增 linters
    - embeddedstructfieldcheck
    - funcorder
    - godoclint
    - iotamixing
    - modernize
    - noinlineerr
    - prealloc
    - wsl_v5

  exclusions:
    rules:
      - path: '_test\.go'
        linters:
          - dupl
          - goconst
          - errcheck
          - govet
          - revive
          - staticcheck
          - unused
      - path: 'internal/ssl/ocsp_test\.go'
        linters:
          - unparam
      - path: 'internal/lua/'
        text: "stutters"
        linters:
          - revive

  settings:
    errcheck:
      check-type-assertions: true
      check-blank: false

    govet:
      enable-all: true
      disable:
        - fieldalignment

    staticcheck:
      checks:
        - all
        - -ST1000
        - -ST1003

    revive:
      severity: warning
      rules:
        - name: unused-parameter
          severity: warning
        - name: unreachable-code
          severity: error
        - name: context-as-argument
          severity: warning
        - name: error-naming
          severity: warning
        - name: error-return
          severity: error
        - name: exported
          severity: warning
          arguments:
            - "disableStutteringCheck"
