- Expand .golangci.yml with more linters (bodyclose, errcheck, etc.), settings for govet, revive, gocritic, gosec - Add // nolint:gosec comments for intentional file operations and subprocesses - Change file write permissions from 0644 to 0600 for better security - Refactor loops, error handling, and test parallelism with t.Parallel() - Minor fixes: ignore unused args, use errors.Is, adjust mkdir permissions to 0750
108 lines
2.3 KiB
YAML
108 lines
2.3 KiB
YAML
version: "2"
|
|
|
|
run:
|
|
timeout: 5m
|
|
tests: true
|
|
concurrency: 4
|
|
|
|
linters:
|
|
disable-all: true
|
|
enable:
|
|
- bodyclose
|
|
- copyloopvar
|
|
- errcheck
|
|
- errorlint
|
|
- govet
|
|
- ineffassign
|
|
- intrange
|
|
- misspell
|
|
- nilnil
|
|
- prealloc
|
|
- sloglint
|
|
- staticcheck
|
|
- tparallel
|
|
- unconvert
|
|
- unparam
|
|
- unused
|
|
- usestdlibvars
|
|
|
|
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"
|