Files
compose/.golangci.yml
T
2026-09-10 10:25:34 +02:00

125 lines
3.2 KiB
YAML

version: "2"
run:
concurrency: 2
build-tags:
- e2e # Avoid "unused" linter issues for code only used in e2e.
linters:
default: none
disable:
# gocognit deliberately replaced gocyclo — do not re-enable. Cyclomatic
# complexity charges a flat guard clause the same as a nested branch, so
# our fail-fast style accumulated //nolint suppressions on functions that
# are long but flat. Cognitive complexity penalizes nesting and barely
# charges early returns, keeping the signal on genuinely tangled code.
- gocyclo
enable:
- copyloopvar
- depguard
- errcheck
- errorlint
- forbidigo
- gocognit
- gocritic
- gomodguard_v2
- govet
- ineffassign
- lll
- misspell
- nakedret
- nolintlint
- perfsprint
- revive
- staticcheck
- testifylint
- unconvert
- unparam
- unused
settings:
depguard:
rules:
all:
deny:
- pkg: io/ioutil
desc: io/ioutil package has been deprecated
- pkg: github.com/docker/docker/errdefs
desc: use github.com/containerd/errdefs instead.
- pkg: golang.org/x/exp/maps
desc: use stdlib maps package
- pkg: golang.org/x/exp/slices
desc: use stdlib slices package
- pkg: gopkg.in/yaml.v2
desc: compose-go uses yaml.v3
- pkg: github.com/stretchr/testify/assert
desc: Use "gotest.tools/v3/assert" instead
- pkg: github.com/stretchr/testify/require
desc: Use "gotest.tools/v3/assert" instead
- pkg: github.com/stretchr/testify/suite
desc: Do not use
forbidigo:
analyze-types: true
forbid:
- pattern: 'context\.Background'
pkg: '^context$'
msg: "in tests, use t.Context() instead of context.Background()"
- pattern: 'context\.TODO'
pkg: '^context$'
msg: "in tests, use t.Context() instead of context.TODO()"
gocritic:
disabled-checks:
- paramTypeCombine
- unnamedResult
- whyNoLint
enabled-tags:
- diagnostic
- opinionated
- style
gocognit:
min-complexity: 30
gomodguard_v2:
blocked:
- module: github.com/pkg/errors
recommendations:
- errors
- fmt
- module: github.com/distribution/distribution
reason: use distribution/reference
- module: gotest.tools
version: < 3.0.0
reason: deprecated, pre-modules version
lll:
line-length: 200
revive:
rules:
- name: package-comments
disabled: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
rules:
- path-except: '_test\.go'
linters:
- forbidigo
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
- gofumpt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
settings:
gci:
sections:
- standard
- default
- localmodule
custom-order: true # make the section order the same as the order of "sections".