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

228 lines
4.0 KiB
YAML

# Copyright (c) 2024 Joshua Rich <joshua.rich@gmail.com>
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
run:
timeout: 5m
output:
sort-results: true
sort-order:
- linter
- severity
- file
show-stats: true
linters:
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- cyclop
- decorder
# - depguard
- dogsled
- dupl
- dupword
- durationcheck
- err113
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
- exhaustruct
- exportloopref
- fatcontext
- forbidigo
- forcetypeassert
- funlen
# - gci
- ginkgolinter
- gocheckcompilerdirectives
# - gochecknoglobals
# - gochecknoinits
- gochecksumtype
- gocognit
- goconst
# - gocritic
- gocyclo
- godot
- godox
- gofmt
- gofumpt
- goheader
- goimports
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
# - nonamedreturns
- nosprintfhostport
- paralleltest
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
# - testpackage
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
- zerologlint
# presets:
# - bugs
# - comment
# - complexity
# - error
# - format
# # - import
# - metalinter
# - module
# - performance
# - sql
# - style
# - test
# - unused
issues:
exclude-rules:
- linters:
- lll
source: "^//go:generate "
- path: '(.+)_test\.go'
text: "copies lock value"
- linters:
- govet
text: "lostcancel"
severity:
default-severity: "@linter"
case-sensitive: false
linters-settings:
errcheck:
check-blank: true
check-type-assertions: true
tagliatelle:
case:
rules:
json: snake
yaml: snake
varnamelen:
ignore-names:
- err
- wg
- tt
- id
- ok
- mu
revive:
enable-all-rules: true
confidence: 0.8
ignore-generated-header: false
rules:
- name: line-length-limit
disabled: true
- name: add-constant
disabled: true
- name: unhandled-error
arguments:
- "fmt.Fprintf"
- ".*.WriteString"
- name: cognitive-complexity
disabled: true
- name: cyclomatic
disabled: true
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/joshuar/go-hass-agent
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
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
lll:
line-length: 140
misspell:
locale: UK
nolintlint:
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
gosec:
excludes:
- G204