external-dns/.golangci.yml
Ivan Ka 6e2fc4aa31
chore(codebase): enable linter nonamedreturns (#5594)
* chore(codebase): enable linter nonamedreturns

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

* chore(codebase): enable linter nonamedreturns

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>

---------

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
2025-07-01 22:13:25 -07:00

105 lines
3.8 KiB
YAML

# https://golangci-lint.run/usage/configuration/
version: "2"
linters:
default: none
enable: # golangci-lint help linters
- copyloopvar # A linter detects places where loop variables are copied. https://golangci-lint.run/usage/linters/#copyloopvar
- dogsled # Checks assignments with too many blank identifiers. https://golangci-lint.run/usage/linters/#dogsled
- dupword # Duplicate word. https://golangci-lint.run/usage/linters/#dupword
- goprintffuncname
- govet
- ineffassign
- misspell
- revive
- recvcheck # Checks for receiver type consistency. https://golangci-lint.run/usage/linters/#recvcheck
- rowserrcheck # Checks whether Rows.Err of rows is checked successfully.
- errchkjson # Checks types passed to the json encoding functions. ref: https://golangci-lint.run/usage/linters/#errchkjson
- errorlint # Checking for unchecked errors in Go code https://golangci-lint.run/usage/linters/#errcheck
- staticcheck
- unconvert
- unused
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. https://golangci-lint.run/usage/linters/#usestdlibvars
- whitespace
- decorder # Check declaration order and count of types, constants, variables and functions. https://golangci-lint.run/usage/linters/#decorder
- tagalign # Check that struct tags are well aligned. https://golangci-lint.run/usage/linters/#tagalign
- predeclared # Find code that shadows one of Go's predeclared identifiers
- sloglint # Ensure consistent code style when using log/slog
- asciicheck # Checks that all code identifiers does not have non-ASCII symbols in the name
- nilnil # Checks that there is no simultaneous return of nil error and an nil value. ref: https://golangci-lint.run/usage/linters/#nilnil
- nonamedreturns # Checks that functions with named return values do not return named values. https://golangci-lint.run/usage/linters/#nonamedreturns
- cyclop # Checks function and package cyclomatic complexity. https://golangci-lint.run/usage/linters/#cyclop
# tests
- testifylint # Checks usage of github.com/stretchr/testify. https://golangci-lint.run/usage/linters/#testifylint
settings:
exhaustive:
default-signifies-exhaustive: false
misspell:
locale: US
revive:
rules:
- name: confusing-naming
disabled: true
cyclop: # Lower cyclomatic complexity threshold after the max complexity is lowered
max-complexity: 44
testifylint:
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
# Default: false
enable-all: true
# Disable checkers by name
# (in addition to default
# suite-thelper
# ).
# TODO: enable in follow-up
disable:
- require-error
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- deadcode
- depguard
- dogsled
- goprintffuncname
- govet
- ineffassign
- misspell
- nolintlint
- rowserrcheck
- staticcheck
- structcheck
- unconvert
- unused
- varcheck
- whitespace
path: _test\.go
# TODO: skiip as will require design changes
- linters:
- nilnil
path: istio_virtualservice.go|fqdn.go|cloudflare.go
paths:
- endpoint/zz_generated.deepcopy.go
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- sigs.k8s.io/external-dns
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
- _test\.go