9275c5a0e1
Bump `golangci-lint` to v2.12.2 and pin `govulncheck` to v1.3.0. Align `.golangci.yml` with the gitea repo's config: enable `revive` `var-naming` (with `skip-package-name-checks`) and drop the test-file exclusion for `errcheck`/`staticcheck`/`unparam`. Fix the now-surfaced `errcheck` violations in test handlers by discarding return values to match the existing codebase pattern. --- This PR was written with the help of Claude Opus 4.7 Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/190 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-committed-by: silverwind <me@silverwind.io>
118 lines
2.5 KiB
YAML
118 lines
2.5 KiB
YAML
version: "2"
|
|
output:
|
|
sort-order:
|
|
- file
|
|
linters:
|
|
default: none
|
|
enable:
|
|
- bidichk
|
|
- bodyclose
|
|
- depguard
|
|
- errcheck
|
|
- forbidigo
|
|
- gocheckcompilerdirectives
|
|
- gocritic
|
|
- govet
|
|
- ineffassign
|
|
- mirror
|
|
- modernize
|
|
- nakedret
|
|
- nilnil
|
|
- nolintlint
|
|
- perfsprint
|
|
- revive
|
|
- staticcheck
|
|
- testifylint
|
|
- unconvert
|
|
- unparam
|
|
- unused
|
|
- usestdlibvars
|
|
- usetesting
|
|
- wastedassign
|
|
settings:
|
|
depguard:
|
|
rules:
|
|
main:
|
|
deny:
|
|
- pkg: io/ioutil
|
|
desc: use os or io instead
|
|
- pkg: golang.org/x/exp
|
|
desc: it's experimental and unreliable
|
|
- pkg: github.com/pkg/errors
|
|
desc: use builtin errors package instead
|
|
nolintlint:
|
|
allow-unused: false
|
|
require-explanation: true
|
|
require-specific: true
|
|
gocritic:
|
|
enabled-checks:
|
|
- equalFold
|
|
disabled-checks: []
|
|
revive:
|
|
severity: error
|
|
rules:
|
|
- name: blank-imports
|
|
- name: constant-logical-expr
|
|
- name: context-as-argument
|
|
- name: context-keys-type
|
|
- name: dot-imports
|
|
- name: empty-lines
|
|
- name: error-return
|
|
- name: error-strings
|
|
- name: exported
|
|
- name: identical-branches
|
|
- name: if-return
|
|
- name: increment-decrement
|
|
- name: modifies-value-receiver
|
|
- name: package-comments
|
|
- name: redefines-builtin-id
|
|
- name: superfluous-else
|
|
- name: time-naming
|
|
- name: unexported-return
|
|
- name: var-declaration
|
|
- name: var-naming
|
|
arguments:
|
|
- [] # AllowList - do not remove as args for the rule are positional and won't work without lists first
|
|
- [] # DenyList
|
|
- - skip-package-name-checks: true
|
|
staticcheck:
|
|
checks:
|
|
- all
|
|
testifylint: {}
|
|
usetesting:
|
|
os-temp-dir: true
|
|
perfsprint:
|
|
concat-loop: false
|
|
govet:
|
|
enable:
|
|
- nilness
|
|
- unusedwrite
|
|
exclusions:
|
|
generated: lax
|
|
presets:
|
|
- comments
|
|
- common-false-positives
|
|
- legacy
|
|
- std-error-handling
|
|
issues:
|
|
max-issues-per-linter: 0
|
|
max-same-issues: 0
|
|
formatters:
|
|
enable:
|
|
- gci
|
|
- gofumpt
|
|
settings:
|
|
gci:
|
|
custom-order: true
|
|
sections:
|
|
- standard
|
|
- prefix(gitea.com/gitea/gitea-mcp)
|
|
- blank
|
|
- default
|
|
gofumpt:
|
|
extra-rules: true
|
|
exclusions:
|
|
generated: lax
|
|
run:
|
|
timeout: 10m
|