-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
115 lines (110 loc) · 3.36 KB
/
Copy path.golangci.yml
File metadata and controls
115 lines (110 loc) · 3.36 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
version: "2"
formatters:
enable:
- gofumpt
- gci
settings:
gofumpt:
extra-rules: true
gci:
sections:
- standard
- default
- prefix(github.com/MH4GF/tq)
linters:
enable:
- staticcheck
- gosec
- revive
- govet
- modernize
- errorlint
- thelper
- nilerr
- unconvert
- ineffassign
- dupword
- misspell
- depguard
- forbidigo
settings:
forbidigo:
analyze-types: true
forbid:
- pattern: '^db\.Open$'
msg: "use testutil.NewTestDB(t) instead of db.Open in tests (golden-rule-5)"
- pattern: '^fmt\.Println$'
msg: "use WriteJSON for structured CLI output (golden-rule-12)"
- pattern: '\.Set[A-Z][A-Za-z]*ForTest\b'
msg: "*ForTest methods are test seams and must not be called from production code (golden-rule-14)"
depguard:
rules:
deny-upward-from-db:
files:
- "**/db/*.go"
deny:
- pkg: github.com/MH4GF/tq/cmd
desc: "db must not import upper layers"
- pkg: github.com/MH4GF/tq/dispatch
desc: "db must not import upper layers"
- pkg: github.com/MH4GF/tq/tui
desc: "db must not import upper layers"
deny-upward-from-dispatch:
files:
- "**/dispatch/*.go"
deny:
- pkg: github.com/MH4GF/tq/cmd
desc: "dispatch must not import upper layers"
- pkg: github.com/MH4GF/tq/tui
desc: "dispatch must not import tui (cross-layer)"
deny-upward-from-tui:
files:
- "**/tui/*.go"
deny:
- pkg: github.com/MH4GF/tq/cmd
desc: "tui must not import upper layers"
- pkg: github.com/MH4GF/tq/dispatch
desc: "tui must not import dispatch (cross-layer)"
deny-upward-from-testutil:
files:
- "**/testutil/*.go"
deny:
- pkg: github.com/MH4GF/tq/cmd
desc: "testutil must not import upper layers"
- pkg: github.com/MH4GF/tq/dispatch
desc: "testutil must not import upper layers"
- pkg: github.com/MH4GF/tq/tui
desc: "testutil must not import upper layers"
revive:
rules:
- name: exported
disabled: true
- name: package-comments
disabled: true
gosec:
excludes:
- G204 # subprocess with variable — expected for tmux/CLI dispatch
- G301 # directory permissions 0750 — 0755 is standard
- G304 # file inclusion via variable — expected for prompt loader
- G306 # file write permissions 0600 — 0644 is standard
exclusions:
rules:
- path: _test\.go
linters:
- errcheck
- gosec
# golden-rule-5: db.Open forbidden only in test files; suppress in non-test files
- path-except: _test\.go
linters:
- forbidigo
text: golden-rule-5
# golden-rule-12: fmt.Println forbidden only in cmd/; suppress elsewhere
- path-except: ^cmd/
linters:
- forbidigo
text: golden-rule-12
# golden-rule-14: *ForTest method calls forbidden only in non-test files; suppress in tests
- path: _test\.go
linters:
- forbidigo
text: golden-rule-14