mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 12:06:45 +00:00
feat: add golangci-lint for Go code quality
- Add .golangci.yml configuration enabling govet, staticcheck, errcheck, gosimple, ineffassign, unused, gofmt, and goimports linters - Update scripts/check.sh to run golangci-lint with go vet fallback - Update CI workflow to install golangci-lint in both format and quality jobs - Add golangci-lint to CONTRIBUTING.md setup instructions Closes #266
This commit is contained in:
56
.golangci.yml
Normal file
56
.golangci.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
# golangci-lint configuration for Mole
|
||||
# https://golangci-lint.run/usage/configuration/
|
||||
|
||||
run:
|
||||
timeout: 5m
|
||||
# Only lint Go code in cmd directory
|
||||
modules-download-mode: readonly
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
# Default linters
|
||||
- govet
|
||||
- staticcheck
|
||||
- gosimple
|
||||
- ineffassign
|
||||
- unused
|
||||
# Additional useful linters
|
||||
- errcheck
|
||||
- gofmt
|
||||
- goimports
|
||||
|
||||
linters-settings:
|
||||
govet:
|
||||
enable-all: true
|
||||
disable:
|
||||
- fieldalignment # struct field alignment optimization is noisy
|
||||
errcheck:
|
||||
# Don't check for errors on these functions (common patterns)
|
||||
exclude-functions:
|
||||
- (io.Closer).Close
|
||||
- (*os/exec.Cmd).Run
|
||||
- (*os/exec.Cmd).Start
|
||||
staticcheck:
|
||||
checks: ["all"]
|
||||
goimports:
|
||||
local-prefixes: github.com/tw93/Mole
|
||||
|
||||
issues:
|
||||
# Don't limit the number of issues per linter
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
|
||||
exclude-rules:
|
||||
# Ignore certain patterns in test files
|
||||
- path: _test\.go
|
||||
linters:
|
||||
- errcheck
|
||||
# Ignore errors from os.Remove in cleanup code
|
||||
- text: "Error return value of `os.Remove` is not checked"
|
||||
linters:
|
||||
- errcheck
|
||||
# Allow unchecked errors on deferred Close calls
|
||||
- text: "Error return value of .*.Close"
|
||||
linters:
|
||||
- errcheck
|
||||
Reference in New Issue
Block a user