runner/.golangci.yml
Earl Warren 0520ff4e05
chore: use t.Context for tests, activate usetesting for lint + add t.TempDir and t.Chdir (#844)
<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/844): <!--number 844 --><!--line 0 --><!--description Y2hvcmU6IHVzZSB0LkNvbnRleHQgZm9yIHRlc3RzLCBhY3RpdmF0ZSB1c2V0ZXN0aW5nIGZvciBsaW50ICsgYWRkIHQuVGVtcERpciBhbmQgdC5DaGRpciBbc2tpcCBjYXNjYWRlXQ==-->chore: use t.Context for tests, activate usetesting for lint + add t.TempDir and t.Chdir [skip cascade]<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/844
Reviewed-by: Gusted <gusted@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-08-11 13:21:42 +00:00

167 lines
3.7 KiB
YAML

version: "2"
linters:
default: none
enable:
- bidichk
- depguard
- dupl
- errcheck
- gocritic
- govet
- ineffassign
- misspell
- nakedret
- nolintlint
- revive
- staticcheck
- unconvert
- unused
- usetesting
- wastedassign
settings:
depguard:
rules:
main:
deny:
- pkg: io/ioutil
desc: use os or io instead
gocritic:
disabled-checks:
- ifElseChain
- singleCaseSwitch
nakedret:
max-func-lines: 0
revive:
confidence: 0.8
severity: warning
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: if-return
- name: increment-decrement
- name: var-naming
arguments: [[], [], [{ skipPackageNameChecks: true }]]
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: duplicated-imports
- name: modifies-value-receiver
staticcheck:
checks:
- all
- -ST1003
- -ST1005
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- dupl
- errcheck
- gocyclo
- gosec
- staticcheck
- unparam
path: _test\.go
- linters:
- dupl
- errcheck
- gocyclo
- gosec
path: models/migrations/v
- linters:
- dupl
text: webhook
- linters:
- gocritic
text: '`ID'' should not be capitalized'
- linters:
- gocritic
path: modules/templates/helper.go
- linters:
- unused
text: swagger
- linters:
- errcheck
path: contrib/pr/checkout.go
- linters:
- errcheck
path: models/issue.go
- linters:
- errcheck
path: models/migrations/
- linters:
- errcheck
path: modules/log/
- linters:
- dupl
path: routers/api/v1/repo/issue_subscription.go
- linters:
- dupl
path: routers/repo/view.go
- linters:
- unused
path: models/migrations/
- linters:
- staticcheck
text: argument x is overwritten before first use
- linters:
- staticcheck
path: modules/httplib/httplib.go
- linters:
- dupl
path: models/issue_comment_list.go
- linters:
- misspell
text: '`Unknwon` is a misspelling of `Unknown`'
- linters:
- unused
path: models/update.go
- linters:
- dupl
path: cmd/dump.go
- linters:
- gocritic
text: 'commentFormatting: put a space between `//` and comment text'
- linters:
- gocritic
text: 'exitAfterDefer:'
- linters:
- staticcheck
path: modules/graceful/manager_windows.go
text: 'svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead.'
- linters:
- golint
path: models/user/openid.go
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- gofumpt
settings:
gofumpt:
extra-rules: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$