joshuar-go-hass-agent/.golangci.yaml

126 lines
2.7 KiB
YAML

# Copyright (c) 2023 Joshua Rich <joshua.rich@gmail.com>
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
linters-settings:
revive:
# Maximum number of open files at the same time.
# See https://github.com/mgechev/revive#command-line-flags
# Defaults to unlimited.
max-open-files: 512
enable-all-rules: true
ignore-generated-header: false
rules:
- name: line-length-limit
disabled: true
- name: add-constant
disabled: true
gocyclo:
# Minimal code complexity to report.
# Default: 30 (but we recommend 10-20)
min-complexity: 20
gofmt:
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
dupl:
threshold: 100
funlen:
lines: 180
statements: 100
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
govet:
enable-all: true
check-shadowing: true
lll:
line-length: 140
misspell:
locale: UK
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
linters:
disable-all: true
enable:
- bodyclose
- decorder
- dogsled
- dupl
- errcheck
- errchkjson
- exportloopref
- forcetypeassert
- funlen
- gci
- goconst
- gocritic
- gocyclo
- godot
- gofmt
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- inamedparam
- ineffassign
- lll
- mirror
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- noctx
- nolintlint
- revive
- reassign
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
- bodyclose
- zerologlint
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- funlen
- dupl
- gochecknoinits
- stylecheck
- staticcheck
run:
timeout: 5m
skip-dirs:
- test/testdata_etc
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 10m