-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy path.golangci.yml
More file actions
156 lines (132 loc) · 4.54 KB
/
.golangci.yml
File metadata and controls
156 lines (132 loc) · 4.54 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
version: "2"
run:
# If you change this please run `make lint` to see where else it needs to be
# updated as well.
go: "1.24.6"
# timeout for analysis
timeout: 10m
linters:
default: all
disable:
# Global variables are used in many places throughout the code base.
- gochecknoglobals
# We want to allow short variable names.
- varnamelen
# We want to allow TODOs.
- godox
# Init functions are used by loggers throughout the codebase.
- gochecknoinits
# Allow using default empty values.
- exhaustruct
# Allow tests to be put in the same package.
- testpackage
# Disable tagalign.
- tagalign
# TODO(yy): create a list of allowed packages to import before enabling
# this linter.
- depguard
# Deprecated - this is replaced by wsl_v5.
- wsl
# All available settings of specific linters.
settings:
nlreturn:
# Size of the block (including return statement that is still "OK")
# so no return split required.
block-size: 3
funlen:
# Checks the number of lines in a function.
# If lower than 0, disable the check.
lines: 100
# Checks the number of statements in a function.
statements: 50
tagliatelle:
case:
rules:
json: snake
wsl_v5:
# We adopt a more relaxed cuddling rule by enabling
# `allow-whole-block`. This allows a variable declaration to be
# "cuddled" with a following block if the variable is used anywhere
# within that block, not just as the first statement.
allow-whole-block: true
allow-first-in-block: false
# Disable the leading-whitespace check to resolve a conflict with the
# whitespace linter, which requires a blank line after a function
# signature. This is the standard Go style.
disable:
- leading-whitespace
lll:
# Max line length, lines longer will be reported.
# '\t' is counted as 1 character by default, and can be changed with the
# tab-width option.
# Default: 120.
line-length: 80
# Tab width in spaces.
# Default: 1
tab-width: 8
whitespace:
multi-func: true
multi-if: true
# Defines a set of rules to ignore issues.
# It does not skip the analysis, and so does not ignore "typecheck" errors.
exclusions:
# Mode of the generated files analysis.
#
# - `strict`: sources are excluded by strictly following the Go generated file convention.
# Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\.$`
# This line must appear before the first non-comment, non-blank text in the file.
# https://go.dev/s/generatedcode
# - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.
# - `disable`: disable the generated files exclusion.
#
# Default: strict
generated: lax
# Which file paths to exclude: they will be analyzed, but issues from them won't be reported.
# "/" will be replaced by the current OS file path separator to properly work on Windows.
# Default: []
paths:
- rpc/legacyrpc/
- wallet/deprecated.go
rules:
# Exclude gosec from running for tests so that tests with weak randomness
# (math/rand) will pass the linter.
- path: _test\.go
linters:
- gosec
- funlen
- revive
# Allow duplications in tests so it's easier to follow a single unit
# test.
- dupl
# Allow returning unwrapped errors in tests.
- wrapcheck
- path: mock*
linters:
- revive
# forcetypeassert is skipped for the mock because the test would fail if
# the returned value doesn't match the type, so there's no need to check
# the convert.
- forcetypeassert
# Allow fmt.Printf() in commands.
- path: cmd/commands/*
linters:
- forbidigo
# Allow fmt.Printf() in config parsing.
- path: config\.go
linters:
- forbidigo
issues:
# Show only new issues created after git revision `REV`.
# Default: ""
new-from-rev: 49d94f09c3382dcc9e5c0f61089109d54213b7c5
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
max-issues-per-linter: 0
# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 0
# Make issues output unique by line.
# Default: true
uniq-by-line: false