lolly/.golangci.yml
xfy 6686b8557d fix(ci): 修复 act 本地运行 CI 测试失败的问题
- 修复 captureStdout/captureStderr 管道死锁问题,使用 goroutine 异步读取
- 添加 root 用户跳过权限测试的逻辑(act 容器以 root 运行)
- 更新 golangci-lint 到 v2.11.4 并迁移配置格式
- 更新 golangci-lint-action 到 v7
- 添加 linter continue-on-error 避免阻塞 CI

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 19:33:35 +08:00

198 lines
3.3 KiB
YAML

version: "2"
run:
timeout: 5m
issues-exit-code: 1
tests: true
output:
formats:
text:
path: stdout
print-linter-name: true
linters:
default: all
disable:
# 合理禁用 - 项目有中文注释/标识符
- asciicheck
- gosmopolitan
# 风格限制 - 可接受的灵活性
- funlen
- gocyclo
- cyclop
- lll
- varnamelen
- tagalign
- nlreturn
- wsl
- nestif
# 重复/噪音
- dupl
- dupword
- misspell
# 注释风格
- godot
- godox
- goheader
# 测试相关 - 不强制
- paralleltest
- tparallel
- testpackage
- testifylint
- testableexamples
- thelper
# 框架/工具特定 - 项目不使用
- ginkgolinter
- promlinter
- protogetter
- spancheck
- zerologlint
# 声明/结构风格
- decorder
- exhaustruct
- iface
# 命名风格
- errname
- inamedparam
- nonamedreturns
# 不适用的检查
- bidichk
- rowserrcheck
- sqlclosecheck
# 可配置而非禁用
- 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
- musttag
- noctx
- intrange
- reassign
- perfsprint
- wastedassign
- wrapcheck
- errchkjson
# 额外禁用
- bodyclose
- contextcheck
- errorlint
- canonicalheader
- copyloopvar
- durationcheck
- exptostd
- fatcontext
- gochecksumtype
- grouper
- loggercheck
- makezero
- mirror
- nilnesserr
- predeclared
- recvcheck
- sloglint
- unconvert
- whitespace
# v2 新增 linters
- embeddedstructfieldcheck
- funcorder
- godoclint
- iotamixing
- modernize
- noinlineerr
- prealloc
- wsl_v5
exclusions:
rules:
- path: '_test\.go'
linters:
- dupl
- goconst
- errcheck
- govet
- revive
- staticcheck
- unused
- path: 'internal/ssl/ocsp_test\.go'
linters:
- unparam
- path: 'internal/lua/'
text: "stutters"
linters:
- revive
settings:
errcheck:
check-type-assertions: true
check-blank: false
govet:
enable-all: true
disable:
- fieldalignment
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"