mirror of https://github.com/go-gitea/gitea.git
update to golangci-lint v2 (#34054)
updates config to v2. config was generated with migrate command. disable all newly exposed issues because there are too many.pull/34068/head
parent
5023238088
commit
5564c39105
281
.golangci.yml
281
.golangci.yml
|
@ -1,7 +1,9 @@
|
||||||
|
version: "2"
|
||||||
|
output:
|
||||||
|
sort-order:
|
||||||
|
- file
|
||||||
linters:
|
linters:
|
||||||
enable-all: false
|
default: none
|
||||||
disable-all: true
|
|
||||||
fast: false
|
|
||||||
enable:
|
enable:
|
||||||
- bidichk
|
- bidichk
|
||||||
- depguard
|
- depguard
|
||||||
|
@ -9,141 +11,168 @@ linters:
|
||||||
- errcheck
|
- errcheck
|
||||||
- forbidigo
|
- forbidigo
|
||||||
- gocritic
|
- gocritic
|
||||||
- gofmt
|
|
||||||
- gofumpt
|
|
||||||
- gosimple
|
|
||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- nakedret
|
- nakedret
|
||||||
- nolintlint
|
- nolintlint
|
||||||
- revive
|
- revive
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- stylecheck
|
|
||||||
- testifylint
|
- testifylint
|
||||||
- typecheck
|
|
||||||
- unconvert
|
- unconvert
|
||||||
- unused
|
|
||||||
- unparam
|
- unparam
|
||||||
|
- unused
|
||||||
- usetesting
|
- usetesting
|
||||||
- wastedassign
|
- wastedassign
|
||||||
|
settings:
|
||||||
run:
|
depguard:
|
||||||
timeout: 10m
|
rules:
|
||||||
|
main:
|
||||||
output:
|
deny:
|
||||||
sort-results: true
|
- pkg: encoding/json
|
||||||
sort-order: [file]
|
desc: use gitea's modules/json instead of encoding/json
|
||||||
show-stats: true
|
- pkg: github.com/unknwon/com
|
||||||
|
desc: use gitea's util and replacements
|
||||||
linters-settings:
|
- pkg: io/ioutil
|
||||||
testifylint:
|
desc: use os or io instead
|
||||||
disable:
|
- pkg: golang.org/x/exp
|
||||||
- go-require
|
desc: it's experimental and unreliable
|
||||||
- require-error
|
- pkg: code.gitea.io/gitea/modules/git/internal
|
||||||
stylecheck:
|
desc: do not use the internal package, use AddXxx function instead
|
||||||
checks: ["all", "-ST1005", "-ST1003"]
|
- pkg: gopkg.in/ini.v1
|
||||||
nakedret:
|
desc: do not use the ini package, use gitea's config system instead
|
||||||
max-func-lines: 0
|
- pkg: gitea.com/go-chi/cache
|
||||||
gocritic:
|
desc: do not use the go-chi cache package, use gitea's cache system
|
||||||
disabled-checks:
|
gocritic:
|
||||||
- ifElseChain
|
disabled-checks:
|
||||||
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
|
- ifElseChain
|
||||||
revive:
|
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
|
||||||
severity: error
|
revive:
|
||||||
|
severity: error
|
||||||
|
rules:
|
||||||
|
- name: atomic
|
||||||
|
- name: bare-return
|
||||||
|
- name: blank-imports
|
||||||
|
- name: constant-logical-expr
|
||||||
|
- name: context-as-argument
|
||||||
|
- name: context-keys-type
|
||||||
|
- name: dot-imports
|
||||||
|
- name: duplicated-imports
|
||||||
|
- name: empty-lines
|
||||||
|
- name: error-naming
|
||||||
|
- name: error-return
|
||||||
|
- name: error-strings
|
||||||
|
- name: errorf
|
||||||
|
- name: exported
|
||||||
|
- name: identical-branches
|
||||||
|
- name: if-return
|
||||||
|
- name: increment-decrement
|
||||||
|
- name: indent-error-flow
|
||||||
|
- name: modifies-value-receiver
|
||||||
|
- name: package-comments
|
||||||
|
- name: range
|
||||||
|
- name: receiver-naming
|
||||||
|
- name: redefines-builtin-id
|
||||||
|
- name: string-of-int
|
||||||
|
- name: superfluous-else
|
||||||
|
- name: time-naming
|
||||||
|
- name: unconditional-recursion
|
||||||
|
- name: unexported-return
|
||||||
|
- name: unreachable-code
|
||||||
|
- name: var-declaration
|
||||||
|
- name: var-naming
|
||||||
|
staticcheck:
|
||||||
|
checks:
|
||||||
|
- all
|
||||||
|
- -ST1003
|
||||||
|
- -ST1005
|
||||||
|
- -QF1001
|
||||||
|
- -QF1002
|
||||||
|
- -QF1003
|
||||||
|
- -QF1006
|
||||||
|
- -QF1007
|
||||||
|
- -QF1008
|
||||||
|
- -QF1009
|
||||||
|
- -QF1012
|
||||||
|
testifylint:
|
||||||
|
disable:
|
||||||
|
- go-require
|
||||||
|
- require-error
|
||||||
|
- equal-values
|
||||||
|
- empty
|
||||||
|
- formatter
|
||||||
|
- len
|
||||||
|
usetesting:
|
||||||
|
os-temp-dir: true
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
- legacy
|
||||||
|
- std-error-handling
|
||||||
rules:
|
rules:
|
||||||
- name: atomic
|
- linters:
|
||||||
- name: bare-return
|
- dupl
|
||||||
- name: blank-imports
|
- errcheck
|
||||||
- name: constant-logical-expr
|
- gocyclo
|
||||||
- name: context-as-argument
|
- gosec
|
||||||
- name: context-keys-type
|
- staticcheck
|
||||||
- name: dot-imports
|
- unparam
|
||||||
- name: duplicated-imports
|
path: _test\.go
|
||||||
- name: empty-lines
|
- linters:
|
||||||
- name: error-naming
|
- dupl
|
||||||
- name: error-return
|
- errcheck
|
||||||
- name: error-strings
|
- gocyclo
|
||||||
- name: errorf
|
- gosec
|
||||||
- name: exported
|
path: models/migrations/v
|
||||||
- name: identical-branches
|
- linters:
|
||||||
- name: if-return
|
- forbidigo
|
||||||
- name: increment-decrement
|
path: cmd
|
||||||
- name: indent-error-flow
|
- linters:
|
||||||
- name: modifies-value-receiver
|
- dupl
|
||||||
- name: package-comments
|
text: (?i)webhook
|
||||||
- name: range
|
- linters:
|
||||||
- name: receiver-naming
|
- gocritic
|
||||||
- name: redefines-builtin-id
|
text: (?i)`ID' should not be capitalized
|
||||||
- name: string-of-int
|
- linters:
|
||||||
- name: superfluous-else
|
- deadcode
|
||||||
- name: time-naming
|
- unused
|
||||||
- name: unconditional-recursion
|
text: (?i)swagger
|
||||||
- name: unexported-return
|
- linters:
|
||||||
- name: unreachable-code
|
- staticcheck
|
||||||
- name: var-declaration
|
text: (?i)argument x is overwritten before first use
|
||||||
- name: var-naming
|
- linters:
|
||||||
gofumpt:
|
- gocritic
|
||||||
extra-rules: true
|
text: '(?i)commentFormatting: put a space between `//` and comment text'
|
||||||
depguard:
|
- linters:
|
||||||
rules:
|
- gocritic
|
||||||
main:
|
text: '(?i)exitAfterDefer:'
|
||||||
deny:
|
paths:
|
||||||
- pkg: encoding/json
|
- node_modules
|
||||||
desc: use gitea's modules/json instead of encoding/json
|
- public
|
||||||
- pkg: github.com/unknwon/com
|
- web_src
|
||||||
desc: use gitea's util and replacements
|
- third_party$
|
||||||
- pkg: io/ioutil
|
- builtin$
|
||||||
desc: use os or io instead
|
- examples$
|
||||||
- pkg: golang.org/x/exp
|
|
||||||
desc: it's experimental and unreliable
|
|
||||||
- pkg: code.gitea.io/gitea/modules/git/internal
|
|
||||||
desc: do not use the internal package, use AddXxx function instead
|
|
||||||
- pkg: gopkg.in/ini.v1
|
|
||||||
desc: do not use the ini package, use gitea's config system instead
|
|
||||||
- pkg: gitea.com/go-chi/cache
|
|
||||||
desc: do not use the go-chi cache package, use gitea's cache system
|
|
||||||
usetesting:
|
|
||||||
os-temp-dir: true
|
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
max-issues-per-linter: 0
|
max-issues-per-linter: 0
|
||||||
max-same-issues: 0
|
max-same-issues: 0
|
||||||
exclude-dirs: [node_modules, public, web_src]
|
formatters:
|
||||||
exclude-case-sensitive: true
|
enable:
|
||||||
exclude-rules:
|
- gofmt
|
||||||
- path: _test\.go
|
- gofumpt
|
||||||
linters:
|
settings:
|
||||||
- gocyclo
|
gofumpt:
|
||||||
- errcheck
|
extra-rules: true
|
||||||
- dupl
|
exclusions:
|
||||||
- gosec
|
generated: lax
|
||||||
- unparam
|
paths:
|
||||||
- staticcheck
|
- node_modules
|
||||||
- path: models/migrations/v
|
- public
|
||||||
linters:
|
- web_src
|
||||||
- gocyclo
|
- third_party$
|
||||||
- errcheck
|
- builtin$
|
||||||
- dupl
|
- examples$
|
||||||
- gosec
|
|
||||||
- path: cmd
|
run:
|
||||||
linters:
|
timeout: 10m
|
||||||
- forbidigo
|
|
||||||
- text: "webhook"
|
|
||||||
linters:
|
|
||||||
- dupl
|
|
||||||
- text: "`ID' should not be capitalized"
|
|
||||||
linters:
|
|
||||||
- gocritic
|
|
||||||
- text: "swagger"
|
|
||||||
linters:
|
|
||||||
- unused
|
|
||||||
- deadcode
|
|
||||||
- text: "argument x is overwritten before first use"
|
|
||||||
linters:
|
|
||||||
- staticcheck
|
|
||||||
- text: "commentFormatting: put a space between `//` and comment text"
|
|
||||||
linters:
|
|
||||||
- gocritic
|
|
||||||
- text: "exitAfterDefer:"
|
|
||||||
linters:
|
|
||||||
- gocritic
|
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -28,7 +28,7 @@ XGO_VERSION := go-1.24.x
|
||||||
AIR_PACKAGE ?= github.com/air-verse/air@v1
|
AIR_PACKAGE ?= github.com/air-verse/air@v1
|
||||||
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.2.1
|
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.2.1
|
||||||
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.7.0
|
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.7.0
|
||||||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.7
|
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
|
||||||
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.12
|
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.12
|
||||||
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.6.0
|
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.6.0
|
||||||
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0
|
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0
|
||||||
|
|
Loading…
Reference in New Issue