-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.golangci.yml
136 lines (131 loc) · 5.2 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
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
# tested with golangci/golangci-lint:v1.61.0
linters:
enable-all: true
disable:
# check that no global variables exist
# disabled because there are some cases where its nice to have globals like `var MyCmd = &cli.Command{[...]`
- gochecknoglobals
# Reports unused function parameters
# disabled because to many false positives
- unparam
# Checks that no init functions are present in Go code
# disabled because init functions are ok, not nice, just ok
- gochecknoinits
# Whitespace Linter - Forces you to use empty lines!
# disabled because go fmt is enough
- wsl
# An analyzer to detect magic numbers.
# disabled because it is very annoying and brings little improvement
- gomnd
# Golang linter to check the errors handling expressions
# disabled because it forces a lot that does not work with golang github pkg errors
- err113
# Tool for detection of FIXME, TODO and other comment keywords
# disabled because it is ok
- godox
# Check if comments end in a period
# disabled because it is very annoying and brings little improvement
- godot
# Go linter that checks if package imports are in a list of acceptable packages
# disabled because we allow everything!
- depguard
# nlreturn checks for a new line before return and branch statements to increase code clarity
# disabled because it is very annoying and brings little improvement
- nlreturn
# forbidigo is a Go static analysis tool to forbidigo use of particular identifiers
# disabled because the linter forbids fmt.Printf/Errorf
- forbidigo
# check exhaustiveness of enum switch statements
# disabled because it does not work correctly on switch cases with default block
- exhaustive
# Gofumpt checks whether code was gofumpt-ed.
# disabled because we dont need another format / way too restrictive to new lines
- gofumpt
# Gci control golang package import order and make it always deterministic.
# disabled because it is not needed
- gci
# Checks that errors returned from external packages are wrapped
# disabled because even errors returned from internal interfaces must me wrapped, which is overkill
- wrapcheck
# rename of exhaustivestruct linter, same reasons
- exhaustruct
# checks if functions return interfaces. Disabled because interfaces are an integral part of our code generation
- ireturn
# prevents named returns. Disabled because we don't share the authors fervor against named returns
- nonamedreturns
- varnamelen # unneeded, short varnames can be reasonable i.e i= index, n= amount or s *Service, reviewer should pay attention to disapprove lines like ´for i, e := range l {}´
- protogetter # disabled because it is very annoying and brings little improvement
linters-settings:
# Vet examines Go source code and reports suspicious constructs, such as Printf calls whose
govet:
enable:
- shadow
# revive differs from gofmt. Gofmt reformats Go source code, whereas revive prints out style mistakes
revive:
# minimal confidence for issues
confidence: 0
severity: error
formatter: friendly
# Computes and checks the cyclomatic complexity of functions
gocyclo:
# minimal code complexity to report
min-complexity: 20
# Tool to detect Go structs that would take less memory if their fields were sorted
maligned:
# print struct with more effective memory layout or not
suggest-new: true
# Tool for code clone detection
dupl:
# tokens count to trigger issue
threshold: 100
# Finds repeated strings that could be replaced by a constant
goconst:
# minimal length of string constant
min-len: 3
# minimal occurrences count to trigger
min-occurrences: 3
# Finds commonly misspelled English words in comments
misspell:
locale: US
# Reports long lines
lll:
line-length: 180
# Tool for detection of long functions
funlen:
lines: 100
statements: 60
# The most opinionated Go source code linter
gocritic:
disabled-checks:
# Detects repeated if-else statements and suggests to replace them with switch statement.
- ifElseChain
# Detects comments with non-idiomatic formatting (space between // and the text).
- commentFormatting
# go-errorlint is a source code linter for Go software that can be used to find code that will cause
errorlint:
# Report non-wrapping error creation using fmt.Errorf
# disabled because sometimes formatting an error with '%+v' instead of '%w' is required to print the stacktrace
errorf: false
issues:
# show more issues of the same type
max-same-issues: 100
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-dirs:
- tests?/
- pkg/pb/
exclude-files:
- .*_?generated\.go
exclude-rules:
# Exclude lll issues for long lines with go:generate
- linters:
- lll
source: "^//go:generate "
- linters:
- staticcheck
# activate it when github.com/golang/protobuf/proto is migrated to google.golang.org/protobuf/proto
text: "SA1019: package github.com/golang/protobuf/proto is deprecated:"
run:
tests: false
build-tags:
- codeanalysis
timeout: 10m