-
Notifications
You must be signed in to change notification settings - Fork 3
/
.golangci.yml
96 lines (92 loc) · 2.94 KB
/
.golangci.yml
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
run:
tests: true
timeout: 2m
issues-exit-code: 1
skip-dirs-use-default: true
modules-download-mode: readonly
output:
print-linter-name: true
print-issued-lines: true
linters:
fast: true
enable:
- errcheck # Locates unchecked errors in function returns
- exhaustive # Reports non-exhaustive switch statements
- exportloopref # Finds exporting pointers for loop variables
- funlen # Limits the max lines and statements of functions
- gochecknoinits # Forbids init function declarations in packages (side-effects)
- goconst # Enforces constants are created for repeated strings
- gocritic # Offers an opinionated set of best practices
- gocyclo # Analyzes code complexity (cyclomatic)
- godot # Enforces comments always end with a period
- gofmt # Enforces source code is properly formatted
- gomnd # Forbids magic numbers from being used without declaration
- gosec # Inspects source code for security problems
- gosimple # Offers code simplification suggestions
- govet # Reports suspicious construct (e.g. Printf with bad parameter count)
- ineffassign # Detects unused existing variable assignments
- lll # Limits maximum line lengths
- nakedret # Prevents naked returns from being used in large functions
- nestif # Limits the amount of nested ifs
- staticcheck # Applies many static analysis checks (similar to govet)
- typecheck # Parses and type-checks code
- unconvert # Reports unnecessary type conversions
- unused # Reports unused variables, constants, struct fields and code
- unparam # Reports unused function parameters
- whitespace # Enforces no excessive whitespace is used (e.g. two line breaks)
issues:
exclude-use-default: true
max-issues-per-linter: 0
max-same-issues: 0
new: false
exclude-rules:
- path: _test\.go
linters:
- goconst
- gocritic
- gosec
- lll
linters-settings:
errcheck:
check-blank: true
check-type-assertions: false
exhaustive:
default-signifies-exhaustive: true
funlen:
lines: 100
statements: 40
goconst:
min-len: 3
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- performance
- style
disabled-checks:
- emptyStringTest
- unnecessaryBlock
- whyNoLint
gocyclo:
min-complexity: 8
godot:
exclude:
- "^(FIXME|TODO) " # technical comments not meant for go doc
- "\\*$" # multiline comments with asterisk indentation
gofmt:
simplify: true
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
lll:
line-length: 120
tab-width: 4
nakedret:
max-func-lines: 30
nestif:
min-complexity: 4
whitespace:
multi-if: true
multi-func: false