-
Notifications
You must be signed in to change notification settings - Fork 4
/
.golangci.yaml
109 lines (103 loc) · 3.29 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
108
109
run:
timeout: 5m
linters:
enable:
# region General
# Add depguard to prevent adding additional dependencies.
- depguard
# Prevent improper directives in go.mod.
- gomoddirectives
# Prevent improper nolint directives.
- nolintlint
# endregion
# region Code Quality and Comments
# Inspect source code for potential security problems. This check has a fairly high false positive rate,
# comment with //nolint:gosec where not relevant.
- gosec
# Replaces deprecated golint.
- revive
# Complain about deeply nested if cases.
- nestif
# Prevent naked returns in long functions.
- nakedret
# Make Go code more readable.
- gocritic
# Check for global variables.
- gochecknoglobals
# Check if comments end in a period. This helps prevent incomplete comment lines, such as half-written sentences.
- godot
# Complain about comments as these indicate incomplete code.
- godox
# Keep the cyclomatic complexity of functions to a reasonable level.
- gocyclo
# Complain about cognitive complexity of functions.
- gocognit
# Find repeated strings that could be converted into constants.
- goconst
# Complain about unnecessary type conversions.
- unconvert
# Complain about unused parameters. These should be replaced with underscores.
- unparam
# Check for non-ASCII identifiers.
- asciicheck
# Check for HTTP response body being closed. Sometimes, you may need to disable this using //nolint:bodyclose.
- bodyclose
# Check for duplicate code. You may want to disable this with //nolint:dupl if the source code is the same, but
# legitimately exists for different reasons.
- dupl
# Check for pointers in loops. This is a typical bug source.
- exportloopref
# Enforce a reasonable function length of 60 lines or 40 instructions. In very rare cases you may want to disable
# this with //nolint:funlen if there is absolutely no way to split the function in question.
- funlen
# Prevent dogsledding (mass-ignoring return values). This typically indicates missing error handling.
- dogsled
# Enforce consistent import aliases across all files.
- importas
# Make package imports always deterministic.
- gci
# Make code properly formatted.
- gofmt
# Prevent faulty error checks.
- nilerr
# Prevent direct error checks that won't work with wrapped errors.
- errorlint
# Find slice usage that could potentially be preallocated.
- prealloc
# Check for improper duration handling.
- durationcheck
# Check for magic numbers
- gomnd
# Check that errors returned from external packages are wrapped.
- wrapcheck
# endregion
linters-settings:
depguard:
list-type: whitelist
include-go-root: false
packages:
- github.com/lib/pq
- nav/constants
- nav/config
- github.com/spf13/pflag
- github.com/onsi/ginkgo
- github.com/onsi/gomega
govet:
enable-all: true
check-shadowing: false
disable:
# Do not check variable shadowing.
- shadow
stylecheck:
checks:
- all
issues:
exclude-use-default: false
exclude-rules:
- linters:
- gofmt
source: "//"
- linters:
- gofmt
- revive
source: "/*"