# golangci-lint configuration for archie-core. # # Schema: https://golangci-lint.run/jsonschema/golangci.jsonschema.json # Every option is documented upstream in .golangci.reference.yml. # Validate changes with `golangci-lint config verify` before committing. # # Philosophy: this repo's gate is `task check`, and archied runs that same # gate against its own PRs. A linter here is therefore an environmental # constraint an agent cannot argue its way around -- the doctrine CLAUDE.md # applies to safety, applied to structure. Curated over exhaustive: a noisy # gate gets disabled, and a disabled gate enforces nothing. version: "2" run: timeout: 5m tests: true go: "1.26" linters: default: standard enable: # Structure and complexity - cyclop - dupl - funlen - gocognit - gocyclo - maintidx - nestif # Architecture - depguard - importas - interfacebloat # Correctness - bodyclose - containedctx - contextcheck - copyloopvar - durationcheck - errorlint - fatcontext - forcetypeassert - gosec - makezero - nilerr - nilnesserr - noctx - reassign - recvcheck - rowserrcheck - sqlclosecheck # Idiom and hygiene - gocritic - godox - misspell - predeclared - sloglint - unconvert - usestdlibvars - usetesting settings: # Each service links only its own composition: services reach each other # through their gRPC contracts, never another service's packages. depguard: rules: gateway-service: files: ["**/internal/app/archiegateway/**"] deny: - {pkg: "github.com/samcharles93/archie-core/internal/daemon", desc: "the daemon is another service"} - {pkg: "github.com/samcharles93/archie-core/internal/webui", desc: "the web UI is another service"} - {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "the daemon is another service"} - {pkg: "github.com/samcharles93/archie-core/internal/app/statestore", desc: "reach the State Store through its contract"} state-store-service: files: ["**/internal/app/statestore/**"] deny: - {pkg: "github.com/samcharles93/archie-core/internal/daemon", desc: "the daemon is another service"} - {pkg: "github.com/samcharles93/archie-core/internal/webui", desc: "the web UI is another service"} - {pkg: "github.com/samcharles93/archie-core/internal/gateway", desc: "the Gateway is another service"} - {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "the daemon is another service"} - {pkg: "github.com/samcharles93/archie-core/internal/app/archiegateway", desc: "the Gateway is another service"} - {pkg: "github.com/nats-io", desc: "the State Store serves gRPC only"} dashboard-service: files: ["**/internal/webui/**", "**/internal/app/archieui/**", "**/cmd/archie-ui/**"] deny: - {pkg: "github.com/samcharles93/archie-core/internal/container", desc: "only the daemon owns containers"} - {pkg: "github.com/samcharles93/archie-core/internal/agentexec", desc: "only the daemon owns containers"} - {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "the daemon is another service"} messaging-service: files: ["**/internal/app/archiemessaging/**", "**/cmd/archie-messaging/**"] deny: - {pkg: "github.com/jackc/pgx", desc: "reach the State Store through its contract"} - {pkg: "github.com/samcharles93/archie-core/internal/infrastructure/postgres", desc: "reach the State Store through its contract"} - {pkg: "github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore", desc: "reach the State Store through its contract"} - {pkg: "github.com/samcharles93/archie-core/internal/domain/workflow", desc: "the workflow engine is the daemon's"} - {pkg: "github.com/samcharles93/archie-core/internal/agentexec", desc: "agent execution is the daemon's"} # The single binary replaces the services slice by slice. It never # imports their packages, so each old path can be deleted outright. single-binary: files: ["**/cmd/archie/**", "**/internal/app/archie/**", "**/internal/platform/**", "**/modules/**"] deny: - {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "an old service; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/app/statestore", desc: "an old service; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/app/archiegateway", desc: "an old service; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/app/archiemessaging", desc: "an old service; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/app/archieui", desc: "an old service; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/app/servicekit", desc: "old service plumbing"} - {pkg: "github.com/samcharles93/archie-core/internal/daemon", desc: "old service code; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/gateway", desc: "old service code; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/webui", desc: "old service code; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/domain", desc: "old domain code; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/infrastructure", desc: "old infrastructure; move what you need into a module"} - {pkg: "github.com/samcharles93/archie-core/internal/contracts/state", desc: "an internal service contract being deleted"} - {pkg: "github.com/samcharles93/archie-core/internal/contracts/gateway", desc: "an internal service contract being deleted"} - {pkg: "github.com/samcharles93/archie-core/internal/contracts/daemon", desc: "an internal service contract being deleted"} - {pkg: "github.com/samcharles93/archie-core/internal/contracts/controlplane", desc: "an internal service contract being deleted"} - {pkg: "github.com/samcharles93/archie-core/internal/contracts/messaging", desc: "an internal service contract being deleted"} - {pkg: "github.com/samcharles93/archie-core/internal/contracts/logging", desc: "an internal service contract being deleted"} - {pkg: "github.com/samcharles93/archie-core/internal/contracts/forge", desc: "an internal service contract being deleted"} - {pkg: "github.com/samcharles93/archie-core/internal/contracts/channel", desc: "an internal service contract being deleted"} - {pkg: "github.com/samcharles93/archie-core/internal/config", desc: "the single binary has its own bootstrap config"} - {pkg: "github.com/nats-io", desc: "the single binary has no message bus"} shared: files: ["**/internal/app/servicekit/**"] deny: - {pkg: "github.com/samcharles93/archie-core/internal/daemon", desc: "shared code must not pull in a service"} - {pkg: "github.com/samcharles93/archie-core/internal/webui", desc: "shared code must not pull in a service"} - {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "shared code must not pull in a service"} - {pkg: "github.com/samcharles93/archie-core/internal/app/archiegateway", desc: "shared code must not pull in a service"} - {pkg: "github.com/samcharles93/archie-core/internal/app/statestore", desc: "shared code must not pull in a service"} cyclop: max-complexity: 15 dupl: threshold: 150 funlen: lines: 80 statements: 50 gocognit: min-complexity: 30 gocyclo: min-complexity: 20 maintidx: under: 20 nestif: min-complexity: 5 godox: # Tracked work lives in GitHub Issues. keywords: - FIXME - TODO - HACK - BUG gosec: excludes: - G104 # errcheck covers unchecked errors - G115 # integer conversions are bounded where they occur - G204 # running commands is what the tools and workflow steps do - G304 # file paths come from configuration and confined worktrees interfacebloat: max: 8 sloglint: no-mixed-args: true key-naming-case: snake context: scope exclusions: generated: lax warn-unused: true # npm dependencies are not this module's code. `flatted`, pulled in # transitively by the dashboard toolchain, ships a Go implementation # alongside its JavaScript, and linting a vendored third-party file fails # the gate on complexity nobody here can fix. paths: - ui/node_modules presets: - comments - common-false-positives - legacy rules: # Table-driven tests are supposed to resemble each other, and # splitting one to satisfy a complexity budget makes it harder to # read. Correctness linters still apply to tests. - path: _test\.go linters: - cyclop - dupl - funlen - gocognit - gocyclo - maintidx formatters: # goimports is deliberately absent. golangci-lint's goimports formatter # builds a fresh x/tools ProcessEnv per file, so internal/imports re-reads # and re-parses $GOMODCACHE's module index once per file -- 63 MiB here, # ~155ms each, ~135s across this tree, and again on a cold `golangci-lint # run`. gofumpt and gci cover formatting and grouping; a missing or unused # import is a compile error, and formatter drift is reported by run itself. enable: - gofumpt - gci settings: gofumpt: extra: group-params: true gci: # Matches the grouping already used across this repo. sections: - standard - default - prefix(github.com/samcharles93/archie-core) custom-order: true exclusions: generated: strict issues: # 0 = report everything. The defaults (50 per linter, 3 per message) # silently truncate, which turns the issue count into a number you # cannot track downward. max-issues-per-linter: 0 max-same-issues: 0 output: show-stats: true sort-order: - linter - file