/
golangci.yaml
57 lines (52 loc) · 2.85 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
# Reference of settings:
# https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
# To remedy '<file>: File is not `goimports`-ed (goimports)' do:
# goimports -w -local github.com/SKF <file>
run:
concurrency: 4
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 9m
# all available settings of specific linters
linters-settings:
errcheck:
# default is false: such cases aren't reported by default.
check-blank: true
govet:
# report about shadowed variables
check-shadowing: true
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 20
gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 20
dupl:
# tokens count to trigger issue, 150 by default
threshold: 150
linters:
# list of available linters can be found here: https://golangci-lint.run/usage/linters/
enable:
- bodyclose #- checks whether HTTP response body is closed successfully
- golint #- Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
- rowserrcheck #- checks whether Err of rows is checked successfully
- stylecheck #- Stylecheck is a replacement for golint
- gosec #- Inspects source code for security problems
- unconvert #- Remove unnecessary type conversions
- goconst #- Finds repeated strings that could be replaced by a constant
- gocyclo #- Computes and checks the cyclomatic complexity of functions
- gocognit #- Computes and checks the cognitive complexity of functions
- gofmt #- Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
- goimports #- Goimports does everything that gofmt does. Additionally it checks unused imports
- misspell #- Finds commonly misspelled English words in comments
- unparam #- Reports unused function parameters
- dogsled #- Checks assignments with too many blank identifiers (e.g. x, , , _, := f())
- nakedret #- Finds naked returns in functions greater than a specified function length
- prealloc #- Finds slice declarations that could potentially be preallocated
- godox #- Tool for detection of FIXME, TODO and other comment keywords
- whitespace #- Tool for detection of leading and trailing whitespace
- wsl #- Whitespace Linter - Forces you to use empty lines!
- goprintffuncname #- Checks that printf-like functions are named with f at the end
- gomnd #- An analyzer to detect magic numbers.
- gomodguard #- Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
- nestif #- Reports deeply nested if statements
- noctx #- Check if with context function can be used