opentofu/.golangci.yml
Martin Atkins ad32bde2ae Temporarily disable the complexity-related lint rules
We're intending to gradually improve all of the existing functions that
fail these checks as a separate project from other work, because fixing
for these particular lint rules tends to be too invasive to be safe or
sensible to combine with other work.

Therefore we'll temporarily disable these lints from the main lint run
and add a separate .golangci-complexity.yml that we can use to track our
progress towards eliminating those lint failures without continuing to
litter the code with nolint comments in the meantime.

This also removes all of the existing nolint comments for these linters so
that we can start fresh and review each one as part of our improvement
project.

We'll re-enable these linters (and remove .golangci-complexity.yml) once
each example has either been rewritten to pass the checks or we've
concluded that further decomposition would hurt readability and so added
"nolint" comments back in so we can review whether our lint rules are too
strict once we've got a bunch of examples to consider together.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-01-03 10:41:05 -05:00

126 lines
2.3 KiB
YAML

# Copyright (c) The OpenTofu Authors
# SPDX-License-Identifier: MPL-2.0
# Copyright (c) 2023 HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
run:
timeout: 30m
linters-settings:
errcheck:
check-type-assertions: true
exhaustive:
check:
- switch
- map
funlen:
lines: 100
statements: 50
ignore-comments: true
govet:
enable-all: true
disable:
- fieldalignment # rule is too strict
nolintlint:
require-explanation: true
require-specific: true
cyclop:
max-complexity: 20
gocognit:
min-complexity: 50
goconst:
ignore-tests: true # Is documented to be the default behaviour, but that doesn't seem to be the case
gocritic:
settings:
ifElseChain:
minThreshold: 4
nestif:
min-complexity: 6
issues:
exclude-rules:
- path: (.+)_test.go
linters:
- funlen
- dupl
- revive
- gocognit
- cyclop
- path: (.+)_test.go
text: "ST1003"
- path: (.+)_test.go
text: "var-naming: don't use underscores in Go names"
linters:
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
#- cyclop # (refer to .golangci-complexity.yml)
- dupl
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- exportloopref
- forbidigo
#- funlen # (refer to .golangci-complexity.yml)
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
#- gocognit # (refer to .golangci-complexity.yml)
- goconst
- gocritic
#- gocyclo # (refer to .golangci-complexity.yml)
- goimports
#- gomoddirectives Disabled while we deal with the HCL fork
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- loggercheck
- makezero
- mirror
- mnd
- musttag
- nakedret
#- nestif # (refer to .golangci-complexity.yml)
- nilerr
- nilnil
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- predeclared
- promlinter
- reassign
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- stylecheck
- tenv
- testableexamples
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace