-
Notifications
You must be signed in to change notification settings - Fork 93
/
.golangci.yaml
107 lines (93 loc) · 3.13 KB
/
.golangci.yaml
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
issues:
exclude:
- 'Error return value of .(\w+\.Rollback(.*)). is not checked'
linters:
presets:
- bugs
- comment
- format
- performance
- style
- test
- unused
disable:
# disabled, but which we should enable after dropping support for Go 1.21 as
# they're kind of a good idea
- copyloopvar # lints to make sure that loop variables are _not_ captured since it's not required in Go 1.22+
- intrange # encourages for loops to range over integers like `for i := range(5)` instead of a C-style for
# disabled, but which we should enable with discussion
- wrapcheck # checks that errors are wrapped; currently not done anywhere
# disabled because we're not compliant, but which we should think about
- exhaustruct # checks that properties in structs are exhaustively defined; may be a good idea
- testpackage # requires tests in test packages like `river_test`
# disabled because they're annoying/bad
- interfacebloat # we do in fact want >10 methods on the Adapter interface or wherever we see fit.
- godox # bans TODO statements; total non-starter at the moment
- err113 # wants all errors to be defined as variables at the package level; quite obnoxious
- mnd # detects "magic numbers", which it defines as any number; annoying
- ireturn # bans returning interfaces; questionable as is, but also buggy as hell; very, very annoying
- lll # restricts maximum line length; annoying
- nlreturn # requires a blank line before returns; annoying
- wsl # a bunch of style/whitespace stuff; annoying
linters-settings:
depguard:
rules:
all:
files: ["$all"]
allow:
deny:
- desc: "Use `github.com/google/uuid` package for UUIDs instead."
pkg: "github.com/xtgo/uuid"
not-test:
files: ["!$test"]
deny:
- desc: "Don't use `dbadaptertest` package outside of test environments."
pkg: "github.com/riverqueue/river/internal/dbadaptertest"
- desc: "Don't use `riverinternaltest` package outside of test environments."
pkg: "github.com/riverqueue/river/internal/riverinternaltest"
forbidigo:
forbid:
- msg: "Use `require` variants instead."
p: '^assert\.'
- msg: "Use `Func` suffix for function variables instead."
p: 'Fn\b'
- msg: "Use built-in `max` function instead."
p: '\bmath\.Max\b'
- msg: "Use built-in `min` function instead."
p: '\bmath\.Min\b'
gci:
sections:
- Standard
- Default
- Prefix(github.com/riverqueue)
gomoddirectives:
replace-local: true
gosec:
excludes:
- G404 # use of non-crypto random; overly broad for our use case
revive:
rules:
- name: unused-parameter
disabled: true
tagliatelle:
case:
rules:
json: snake
testifylint:
enable-all: true
disable:
- go-require
varnamelen:
ignore-names:
- db
- eg
- f
- i
- id
- j
- mu
- sb # common convention for string builder
- t
- tt # common convention for table tests
- tx
- wg