-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
117 lines (104 loc) · 6.03 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
# Linters and configuration options: https://golangci-lint.run/usage/configuration
linters:
enable:
- asciicheck # Finds non-ASCII identifiers.
- bodyclose # Checks whether HTTP response body is closed successfully.
- deadcode # Finds unused code.
- depguard # Checks if package imports are in a list of acceptable packages.
- dogsled # Finds assignments with too many blank identifiers (e.g. x, , , _, := f()).
- dupl # Finds code clones.
- errorlint # Finds code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- exportloopref # Checks for pointers to enclosing loop variables.
- forbidigo # Forbids identifiers.
- funlen # Finds long functions.
- gci # Controls package import order and makes it always deterministic.
- gocognit # Computes and checks the cognitive complexity of functions.
- goconst # Finds repeated strings that could be replaced by a constant.
- gocyclo # Computes and checks the cyclomatic complexity of functions.
- godot # Checks if comments end in a period.
- godox # Finds FIXME, TODO, and other comment keywords.
- gofmt # Checks whether code was gofmt'ed.
- gofumpt # Checks whether code was gofumpt'ed.
- goheader # Checks is file header matches pattern.
- goimports # Does everything that gofmt does and checks unused imports.
- golint # Finds style mistakes.
- gomodguard # Allows and blocks list linter for direct module dependencies.
- goprintffuncname # Checks that printf-like functions are named with f at the end.
- gosec # Inspects source code for security problems.
- gosimple # Simplifies code.
- govet # Reports suspicious constructs.
- ineffassign # Detects when assignments to existing variables are not used.
- interfacer # Suggests narrower interface types.
- lll # Reports long lines.
- makezero # Finds slice declarations with non-zero initial length.
- maligned # Finds structs that would take less memory if their fields were sorted.
- misspell # Finds commonly misspelled English words in comments.
- nestif # Reports deeply nested if statements.
- noctx # Finds http requests without context.Context.
- nolintlint # Reports ill-formed or insufficient nolint directives.
- paralleltest # Detects missing usage of t.Parallel() method in tests.
- prealloc # Finds slice declarations that could potentially be preallocated.
- predeclared # Finds code that shadows predeclared identifiers.
- rowserrcheck # Checks whether Err of rows is checked successfully.
- scopelint # Finds unpinned variables.
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
- staticcheck # Applies lots of static analysis checks.
- structcheck # Finds unused struct fields.
- stylecheck # Replacement for golint.
- testpackage # Makes you use a separate _test package.
- thelper # Detects golang test helpers without t.Helper() call and checks the consistency of test helpers.
- tparallel # Detects inappropriate usage of t.Parallel() method in your Go test codes.
- typecheck # Parses and type-checks code.
- unconvert # Finds unnecessary type conversions.
- unparam # Reports unused function parameters.
- unused # Finds unused constants, variables, functions, and types
- varcheck # Finds unused global variables and constants.
- whitespace # Finds leading and trailing whitespace.
disable:
- errcheck # Finds unchecked errors.
- exhaustive # Checks exhaustiveness of enum switch statements.
- exhaustivestruct # Checks if all struct's fields are initialized.
- gochecknoglobals # Checks that no global variables exist.
- gochecknoinits # Checks that no init functions are present.
- gocritic # The most opinionated Go source code linter.
- goerr113 # Checks the errors handling expressions.
- gomnd # Detects magic numbers.
- nakedret # Finds naked returns in functions greater than a specified function length.
- nlreturn # Checks for a new line before return and branch statements.
- wrapcheck # Checks that errors returned from external packages are wrapped.
- wsl # Forces you to use empty lines.
output:
sort-results: true # Sorts results by file, line, and column.
linters-settings:
funlen:
lines: 80 # Increase the maximum allowed lines in a function from 60 to 80.
issues:
exclude-rules:
# lll: line is NNN characters
# (This function definition is necessarily long due to the many named return values.)
- path: algorithms/hsort/hsort.go
linters: lll
source: func initSort
# gosimple: S1008: should use 'return i >= 0' instead of 'if i < 0 { return false }; return true'
# (This is not actually a ternary operation.)
- path: data_structures/hlist/hlist.go
linters: gosimple
source: if i < 0 \{
# -- We are going to ignore the linter warnings below because we want to keep the merge
# -- algorithm intact so as to increase understandability:
# nestif: `if b.merge` is deeply nested (complexity: 7)
- path: algorithms/hsort/hsort.go
linters: nestif
source: if b\.merge \{
# funlen: Function 'Merge' is too long (90 > 80)
- path: algorithms/hsort/hsort.go
linters: funlen
source: func Merge
# funlen: Function 'Sort' is too long (88 > 80)
- path: data_structures/hlist/hlist.go
linters: funlen
source: func \(l \*List\) Sort
# gocognit: cognitive complexity 37 of func `(*List).Sort` is high (> 30)
- path: data_structures/hlist/hlist.go
linters: gocognit
source: func \(l \*List\) Sort