Files
HackBrowserData/.golangci.yml
T
Roger d0971ca098 chore: update CI, golangci-lint, and CLAUDE.md (#511)
* chore: update CI, golangci-lint, and CLAUDE.md
* fix: resolve CI failures on Windows test and lint
* fix: resolve Windows test path and main.go line length lint issues
* fix: auto-format log/ with gofumpt, exclude pre-refactoring lint issues
* fix: resolve remaining lint issues, remove unnecessary exclusions
* fix: remove invalid G117 gosec rule, use text exclusion for secret pattern
* fix: align CI golangci-lint version with local (v2.4 -> v2.10)
2026-03-23 01:40:59 +08:00

217 lines
4.4 KiB
YAML

# golangci-lint v2 configuration
# Compatible with Go 1.20
version: "2"
run:
go: "1.20"
timeout: "5m"
allow-parallel-runners: true
linters:
default: none
enable:
# Default tier
- errcheck
- govet
- staticcheck
- ineffassign
- unused
# Bug detection
- errorlint
- gosec
- sqlclosecheck
# Code quality
- depguard
- dogsled
- dupl
- errname
- funlen
- gocheckcompilerdirectives
- gochecknoinits
- goconst
- gocritic
- godox
- goprintffuncname
- lll
- misspell
- nakedret
- revive
- testifylint
- unconvert
- unparam
- usestdlibvars
- whitespace
# Complexity
- gocognit
# Note: copyloopvar, intrange, modernize, perfsprint require Go 1.22+
# They will be enabled when Go version constraint is lifted
settings:
depguard:
rules:
blocked:
deny:
- pkg: "github.com/pkg/errors"
desc: Use fmt.Errorf with %w or errors stdlib instead.
- pkg: "io/ioutil"
desc: Deprecated since Go 1.16. Use io and os packages instead.
- pkg: "github.com/instana/testify"
desc: Use github.com/stretchr/testify instead.
dupl:
threshold: 100
funlen:
lines: -1
statements: 50
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport
- hugeParam
- rangeValCopy
- ifElseChain
- octalLiteral
- whyNoLint
- singleCaseSwitch
- exitAfterDefer
- commentedOutCode
lll:
line-length: 140
gocognit:
min-complexity: 30
godox:
keywords:
- FIXME
govet:
enable:
- nilness
errorlint:
asserts: false
gosec:
excludes:
- G101
- G104
- G304
- G401
- G405
- G501
- G502
- G505
- G115
- G117
- G204
errcheck:
check-type-assertions: true
exclude-functions:
- "os.Remove"
- "os.RemoveAll"
- "(*database/sql.DB).Close"
- "(*database/sql.Rows).Close"
misspell:
locale: US
revive:
rules:
- name: indent-error-flow
- name: unexported-return
disabled: true
- name: unused-parameter
disabled: true
- name: package-comments
disabled: true
- name: exported
disabled: true
staticcheck:
checks:
- "all"
- "-ST1000"
- "-ST1003"
- "-ST1016"
- "-ST1020"
- "-ST1021"
- "-ST1022"
exclusions:
presets:
- comments
- std-error-handling
- common-false-positives
- legacy
rules:
- path: _test\.go
linters:
- dupl
- funlen
- gosec
- errcheck
- testifylint
- lll
- source: "defer"
linters:
- errcheck
- text: "SELECT"
linters:
- gosec
# Temporary: known issues in pre-refactoring code (will be removed during refactoring)
- text: "result 0 .* is always nil"
linters:
- unparam
- text: "result 0 .* is never used"
linters:
- unparam
- path: "browser/firefox/firefox.go"
text: "field .* is unused"
linters:
- unused
- path: "browserdata/sessionstorage/"
text: "is unused"
linters:
- unused
- path: "cmd/hack-browser-data/main.go"
linters:
- lll
# Temporary: pre-refactoring code issues (all will be rewritten)
- path: "browserdata/"
linters:
- dupl
- gochecknoinits
- goconst
- lll
- path: "browser/firefox/"
linters:
- gocritic
- path: "crypto/"
linters:
- gocritic
- path: "utils/chainbreaker/"
linters:
- gocritic
- path: "browser/exploit/"
linters:
- gocritic
- gocognit
- funlen
- whitespace
- staticcheck
formatters:
enable:
- gofumpt
- goimports
settings:
gofumpt:
extra-rules: true
goimports:
local-prefixes:
- github.com/moond4rk/hackbrowserdata