# SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
#
# SPDX-License-Identifier: CC0-1.0

version: "2"
linters:
  default: none
  # Be specific
  enable:
    - arangolint
    - asasalint
    - asciicheck
    - bidichk
    - bodyclose
    - canonicalheader
    - containedctx
    - contextcheck
    - copyloopvar
    - cyclop
    - decorder
    - dogsled
    - dupl
    - dupword
    - durationcheck
    - embeddedstructfieldcheck
    - err113
    - errcheck
    - errchkjson
    - errname
    - errorlint
    - exhaustive
    - exhaustruct
    - exptostd
    - fatcontext
    - forbidigo
    - forcetypeassert
    - funcorder
    - funlen
    - ginkgolinter
    - gocheckcompilerdirectives
    - gochecknoglobals
    - gochecknoinits
    - gochecksumtype
    - gocognit
    - goconst
    - gocritic
    - gocyclo
    - godoclint
    - godot
    - godox
    - goheader
    - gomoddirectives
    - gomodguard
    - goprintffuncname
    - gosec
    - gosmopolitan
    - govet
    - grouper
    - iface
    - importas
    - inamedparam
    - ineffassign
    - interfacebloat
    - intrange
    - iotamixing
    - ireturn
    - lll
    - loggercheck
    - maintidx
    - makezero
    - mirror
    - misspell
    - mnd
    - musttag
    - nakedret
    - nestif
    - nilerr
    - nilnesserr
    - nilnil
    - nlreturn
    - noctx
    - nolintlint
    - nonamedreturns
    - nosprintfhostport
    - paralleltest
    - perfsprint
    - prealloc
    - predeclared
    - promlinter
    - protogetter
    - reassign
    - recvcheck
    - revive
    - rowserrcheck
    - sloglint
    - spancheck
    - sqlclosecheck
    - staticcheck
    - tagalign
    - tagliatelle
    - testableexamples
    - testifylint
    - testpackage
    - thelper
    - tparallel
    - unconvert
    - unparam
    - unqueryvet
    - unused
    - usestdlibvars
    - usetesting
    - varnamelen
    - wastedassign
    - whitespace
    - wrapcheck
    - wsl_v5
    - zerologlint
    - prealloc

  disable:
    - depguard

  settings:
    exhaustruct:
      exclude:
        # External types where zero values are intentional by library design
        - github.com/modelcontextprotocol/go-sdk/mcp.Implementation
        - github.com/modelcontextprotocol/go-sdk/mcp.Tool
        - github.com/modelcontextprotocol/go-sdk/mcp.Resource
        - github.com/modelcontextprotocol/go-sdk/mcp.ReadResourceResult
        - github.com/modelcontextprotocol/go-sdk/mcp.ResourceContents
        - github.com/modelcontextprotocol/go-sdk/mcp.CallToolResult
        - github.com/modelcontextprotocol/go-sdk/mcp.TextContent
        - git.secluded.site/go-lunatask.CreateTaskRequest
        - git.secluded.site/go-lunatask.UpdateTaskRequest
        # Internal output types where some fields are optional
        - git.sr.ht/~amolith/lunatask-mcp-server/tools/tasks.CreateOutput
        - git.sr.ht/~amolith/lunatask-mcp-server/tools/tasks.UpdateOutput
        - git.sr.ht/~amolith/lunatask-mcp-server/tools/tasks.DeleteOutput
        - git.sr.ht/~amolith/lunatask-mcp-server/tools/habits.TrackOutput
        - git.sr.ht/~amolith/lunatask-mcp-server/tools/timestamp.Output
    tagliatelle:
      case:
        rules:
          json: snake
    varnamelen:
      ignore-names:
        - c   # client
        - f   # file handle
        - id  # entity ID
        - ok  # boolean check
        - db  # database
        - tx  # transaction
        - fn  # function

  exclusions:
    rules:
      - path: cmd/
        linters:
          - gochecknoglobals  # Cobra commands are package-level vars
          - gochecknoinits    # Cobra uses init() for flag registration
          - wrapcheck         # CLI returns errors for display, wrapping adds noise
          - mnd               # Magic numbers in cobra.ExactArgs are clear in context
          - dupl              # Builder types differ but share method signatures
      - path: cmd/
        text: unused-parameter  # Cobra callback signatures can't be changed
      - path: tools/
        linters:
          - err113            # Handler validation errors are descriptive by nature
          - cyclop            # Apply options funcs have many branches but simple logic
          - wrapcheck         # Returning errors to MCP doesn't need wrapping
      - path: internal/config/
        text: "0o700"           # Config directory permissions are intentional
