lolly/.golangci.yml
xfy 1ab49af76d chore(lint): 重构 golangci 配置,重新启用多项检查
重新启用 bodyclose、errorlint、contextcheck、prealloc、unconvert 等检查,
按类别整理禁用项,添加细粒度排除规则。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 17:58:34 +08:00

197 lines
3.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: "2"
run:
timeout: 5m
issues-exit-code: 1
tests: true
output:
formats:
text:
path: stdout
colors: true
linters:
default: all
disable:
# 合理禁用 - 项目有中文注释/标识符
- asciicheck
- gosmopolitan
# 风格限制 - 可接受的灵活性
- funlen
- gocyclo
- cyclop
- lll
- varnamelen
- tagalign
- nlreturn
- wsl
- wsl_v5
- nestif
# 重复/噪音
- dupl
- dupword
- misspell
# 注释风格
- godoclint
- godot
- godox
- goheader
# 测试相关 - 不强制
- paralleltest
- tparallel
- testpackage
- testifylint
- testableexamples
- thelper
# 框架/工具特定 - 项目不使用
- arangolint
- ginkgolinter
- promlinter
- protogetter
- spancheck
- zerologlint
# 声明/结构风格
- decorder
- funcorder
- embeddedstructfieldcheck
- exhaustruct
- iface
# 命名风格
- errname
- inamedparam
- nonamedreturns
# 不适用的检查
- bidichk
- rowserrcheck
- sqlclosecheck
- unqueryvet
# 可配置而非禁用
- forbidigo
- depguard
- gomodguard
- gomoddirectives
- importas
# 复杂度度量
- gocognit
- maintidx
# 噪音/风格 - 已有惯例
- dogsled
- nosprintfhostport
- goprintffuncname
- tagliatelle
- usestdlibvars
- usetesting
- unparam
- mnd
- ireturn
- nakedret
- interfacebloat
- gocritic
- gosec
# 项目特定豁免
- asasalint
- containedctx
- err113
- forcetypeassert
- gochecknoglobals
- gochecknoinits
- nilerr
- nilnil
- modernize
- musttag
- noctx
- intrange
- reassign
- iotamixing
- noinlineerr
- perfsprint
- wastedassign
- wrapcheck
- errchkjson
# 额外禁用(来自 1f13120
- bodyclose
- contextcheck
- errorlint
- canonicalheader
- copyloopvar
- durationcheck
- exptostd
- fatcontext
- gochecksumtype
- grouper
- loggercheck
- makezero
- mirror
- nilnesserr
- predeclared
- recvcheck
- sloglint
- unconvert
- whitespace
exclusions:
rules:
- path: '_test\.go'
linters:
- dupl
- goconst
- path: 'internal/ssl/ocsp_test\.go'
linters:
- unparam
- path: 'internal/lua/'
text: "stutters"
linters:
- revive
settings:
errcheck:
check-type-assertions: true
check-blank: true
govet:
enable-all: true
staticcheck:
checks:
- all
- -ST1000
- -ST1003
revive:
severity: warning
rules:
- name: unused-parameter
severity: warning
- name: unreachable-code
severity: error
- name: context-as-argument
severity: warning
- name: error-naming
severity: warning
- name: error-return
severity: error
- name: exported
severity: warning
arguments:
- "disableStutteringCheck"
formatters:
enable:
- gofmt
settings:
gofmt:
simplify: true