Repository navigation
Expand file tree
/
Copy path.golangci.yaml
More file actions
98 lines (95 loc) · 3.21 KB
/
Copy path.golangci.yaml
File metadata and controls
98 lines (95 loc) · 3.21 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
version: "2"
linters:
enable:
- sqlclosecheck
- bodyclose
- asciicheck
- misspell
- errorlint
- bigint
- depguard
- forbidigo
# Only enabled in specific cases. See settings and exclusions below
- exhaustruct
# Enabled by default but be explicit so it's easy to see what we're running
- errcheck
- govet
- ineffassign
- staticcheck
- unused
settings:
custom:
bigint:
type: "module"
description: "Optimism big.Int checks"
settings: {}
depguard:
rules:
# op-service/log is the monorepo's logging API; geth.go is its one
# binding to the go-ethereum logger.
geth-log:
files:
- $all
- "!**/op-service/log/geth.go"
- "!**/op-service/log/geth_test.go"
deny:
- pkg: github.com/ethereum/go-ethereum/log$
desc: import github.com/ethereum-optimism/optimism/op-service/log instead
forbidigo:
analyze-types: true
forbid:
# op-geth's RPC recording hooks and exported JSON-RPC error are fork-only.
- pattern: ^rpc\.(Recorder|RecordedMsg|RecordDone|WithRecorder|JsonError|Server\.SetRecorder)$
pkg: ^github\.com/ethereum/go-ethereum/rpc$
msg: use github.com/ethereum-optimism/optimism/op-service/jsonrpc instead
# Require specifying all fields in op-deployer's OPCM input and output structs
exhaustruct:
include:
- .*op-deployer/pkg/deployer/opcm\..*(Input|Output)$
staticcheck:
checks:
- all
# Disabled checks
- -S1000 # should use for range instead of for { select {} }
- -QF1001 # could apply De Morgan's law
- -QF1002 # could use tagged switch
- -QF1003 # could use tagged switch
- -QF1006 # could lift into loop condition
- -QF1008 # could remove embedded field from selector (note: no benefit from this check)
- -QF1009 # want to use time.Time.Equal instead
- -QF1011 # could omit type from declaration; it will be inferred from the right-hand side
- -QF1012 # Use fmt.Fprintf(...) instead of WriteString(fmt.Sprintf(...))
- -ST1003 # capitalization of abbreviations
- -ST1005 # error strings should not end with punctuation or newlines
- -ST1008 # error should be returned as the last argument
- -ST1011 # var is of type time.Duration; don't use unit-specific suffix
- -ST1012 # error var mockErr should have name of the form errFoo
- -ST1016 # methods on the same type should have the same receiver name
- -ST1017 # don't use Yoda conditions
- -ST1019 # package is being imported more than once
- -ST1023 # should omit type from declaration; it will be inferred from the right-hand side
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- path: (.+)\.go$
text: errors.As
- path: (.+)\.go$
text: errors.Is
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$