-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
74 lines (66 loc) · 2.31 KB
/
Copy path.golangci.yml
File metadata and controls
74 lines (66 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# golangci-lint v2 config — bug-catcher focus.
#
# Philosophy: lint should flag REAL bugs, not style preferences. Stylistic
# nags belong in code review, not CI gates. If a rule has high false-positive
# rate on this codebase (contextcheck on long-lived background goroutines,
# errcheck on `defer Close()`), it's disabled.
#
# Run: `make lint`
# Docs: https://golangci-lint.run/usage/configuration/
version: "2"
run:
timeout: 5m
tests: true
build-tags:
- integration
linters:
default: none
enable:
# Core bug-catchers — these find real defects.
- govet # suspicious constructs the compiler misses
- ineffassign # assignments that go nowhere
- staticcheck # broad static analysis (includes the old stylecheck/gosimple)
- unused # dead code
- bodyclose # http.Response.Body left open
- nilerr # returning nil after non-nil error check
- rowserrcheck # forgot to check sql.Rows.Err()
- sqlclosecheck # sql.Rows/Stmt not closed
- errcheck # unchecked errors (with exclusions for defer Close)
settings:
errcheck:
# Functions whose return errors have no recovery path or are already
# logged inside a wrapper. SafeSend logs + counts internally — callers
# don't need to handle the error again. Close on read-only file
# handles has no recovery path during deferred cleanup.
exclude-functions:
- (io.Closer).Close
- (*os.File).Close
- (io.ReadCloser).Close
- os.Remove
- encoding/json.Unmarshal
- (*github.com/go-telegram-bot-api/telegram-bot-api/v5.BotAPI).Request
- (*gopher-ops/internal/bot.Deps).SafeSend
staticcheck:
# Disable the style-only "QF" quick-fix checks. They suggest
# `fmt.Fprintf(sb, ...)` over `sb.WriteString(fmt.Sprintf(...))` —
# equally valid, not a bug.
checks:
- "all"
- "-QF1001"
- "-QF1003"
- "-QF1008"
- "-QF1012"
- "-ST1000" # missing package comment — pragmatic for small pkgs
exclusions:
# Tests get relaxed rules — errcheck on test helpers is noise.
rules:
- path: _test\.go
linters:
- errcheck
formatters:
enable:
- gofmt
- goimports
issues:
max-issues-per-linter: 0
max-same-issues: 0