opentofu/.golangci-complexity.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

65 lines
1.5 KiB
YAML

# Copyright (c) The OpenTofu Authors
# SPDX-License-Identifier: MPL-2.0
# Copyright (c) 2023 HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
# This is a temporary variant of .golangci.yml to support our work on improving
# existing functions to pass the code complexity lint rules:
# https://github.com/opentofu/opentofu/issues/2325
#
# If you are working on the code complexity improvement project then you can
# check our progress on the complexity-related lints by running the linters
# as follows:
# golangci-lint run -c .golangci-complexity.yml
#
# Many existing functions were failing multiple linters at once at the start
# of this project, and for as long as that remains true it might be helpful
# to add the --uniq-by-line=false option to review all of the failures at
# once.
#
# This file should be deleted at the same time as we re-enable the five
# complexity-related linters in .golangci.yml.
run:
timeout: 30m
linters-settings:
funlen:
lines: 100
statements: 50
ignore-comments: true
nolintlint:
require-explanation: true
require-specific: true
cyclop:
max-complexity: 20
gocognit:
min-complexity: 50
nestif:
min-complexity: 6
issues:
exclude-rules:
- path: (.+)_test.go
linters:
- funlen
- dupl
- revive
- path: (.+)_test.go
text: "ST1003"
- path: (.+)_test.go
text: "var-naming: don't use underscores in Go names"
linters:
disable-all: true
enable:
- cyclop
- funlen
- gocognit
- gocyclo
- nestif