chore(lint): simplify golangci-lint configuration
Reduce enabled linters to misspell with standard defaults, add gofmt formatter, move errcheck settings, and minimize run and issues configurations for brevity.
This commit is contained in:
parent
f0322a84bd
commit
6f6596c13f
107
.golangci.yml
107
.golangci.yml
@ -1,107 +1,14 @@
|
||||
version: "2"
|
||||
|
||||
run:
|
||||
timeout: 5m
|
||||
tests: true
|
||||
concurrency: 4
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
default: standard
|
||||
enable:
|
||||
- bodyclose
|
||||
- copyloopvar
|
||||
- errcheck
|
||||
- errorlint
|
||||
- govet
|
||||
- ineffassign
|
||||
- intrange
|
||||
- misspell
|
||||
- nilnil
|
||||
- prealloc
|
||||
- sloglint
|
||||
- staticcheck
|
||||
- tparallel
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
- usestdlibvars
|
||||
|
||||
settings:
|
||||
errcheck:
|
||||
check-type-assertions: true
|
||||
check-blank: false
|
||||
formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
|
||||
linters-settings:
|
||||
errcheck:
|
||||
check-type-assertions: true
|
||||
check-blank: false
|
||||
govet:
|
||||
enable-all: true
|
||||
disable:
|
||||
- fieldalignment # Often too pedantic for small projects
|
||||
revive:
|
||||
# Use default rules and a few extra ones
|
||||
rules:
|
||||
- name: blank-imports
|
||||
- name: context-as-first-argument
|
||||
- name: context-keys-type
|
||||
- name: dot-imports
|
||||
- name: error-return
|
||||
- name: error-strings
|
||||
- name: error-naming
|
||||
- name: if-return
|
||||
- name: increment-decrement
|
||||
- name: var-naming
|
||||
- name: var-declaration
|
||||
- name: range
|
||||
- name: receiver-naming
|
||||
- name: time-naming
|
||||
- name: unexported-return
|
||||
- name: indent-error-flow
|
||||
- name: errorf
|
||||
- name: empty-block
|
||||
- name: superfluous-else
|
||||
- name: unreachable-code
|
||||
- name: redefinition
|
||||
- name: unused-parameter
|
||||
arguments:
|
||||
- allowParamNames: "^_"
|
||||
- name: exported
|
||||
disabled: true
|
||||
- name: package-comments
|
||||
disabled: true
|
||||
gocritic:
|
||||
enabled-tags:
|
||||
- diagnostic
|
||||
- experimental
|
||||
- opinionated
|
||||
- performance
|
||||
- style
|
||||
disabled-checks:
|
||||
- hugeParam # Can be noisy
|
||||
- rangeValCopy # Can be noisy
|
||||
- exitAfterDefer # Common in simple CLI tools
|
||||
gosec:
|
||||
excludes:
|
||||
- G204 # Subprocess launched with variable (needed for git commands)
|
||||
- G304 # File inclusion via variable (common in CLI tools)
|
||||
- G306 # Perms 0644 are fine for CLI output
|
||||
- G115 # Int overflow on int64 to int conversion
|
||||
|
||||
issues:
|
||||
exclude-use-default: false
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
exclude: []
|
||||
exclude-rules:
|
||||
- linters:
|
||||
- gosec
|
||||
text: "G304"
|
||||
- linters:
|
||||
- gocritic
|
||||
text: "exitAfterDefer"
|
||||
- path: _test\.go
|
||||
linters:
|
||||
- gosec
|
||||
- unparam
|
||||
- errcheck
|
||||
text: "dc.UpdateStatus|dc.Submit"
|
||||
run:
|
||||
timeout: 5m
|
||||
|
||||
Loading…
Reference in New Issue
Block a user