-
Notifications
You must be signed in to change notification settings - Fork 2
/
.golangci.yml
94 lines (91 loc) · 4.12 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
run:
timeout: 5m
tests: false
skip-dirs:
- vendor
skip-dirs-use-default: true
skip-files:
- generate.go
linters-settings:
goimports:
local-prefixes: github.com/requiemofthesouls/pigeomail
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- unnecessaryDefer
- appendAssign
- importShadow
- sloppyReassign
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
lll:
line-length: 140
gocyclo:
min-complexity: 20
funlen:
lines: 160
statements: 70
nestif:
min-complexity: 6
linters:
disable-all: true
enable:
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
- unused # Checks Go code for unused constants, variables, functions and types
- gosimple # Linter for Go source code that specializes in simplifying a code
- structcheck # Finds unused struct fields
- varcheck # Finds unused global variables and constants
- ineffassign # Detects when assignments to existing variables are not used
- deadcode # Finds unused code
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- bodyclose # checks whether HTTP response body is closed successfully
- noctx # noctx finds sending http request without context.Context
- stylecheck # Stylecheck is a replacement for golint
- gosec # Inspects source code for security problems
- interfacer # Linter that suggests narrower interface types
- unconvert # Remove unnecessary type conversions
- goconst # Finds repeated strings that could be replaced by a constant
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
- 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
- goheader # Checks is file header matches to pattern
- depguard # Go linter that checks if package imports are in a list of acceptable packages
- lll # Reports long lines
- 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
- scopelint # Scopelint checks for unpinned variables in go programs
- gocritic # The most opinionated Go source code linter
- whitespace # Tool for detection of leading and trailing whitespace
- goprintffuncname # Checks that printf-like functions are named with f at the end
- 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.
- testpackage # linter that makes you use a separate _test package
- nestif # Reports deeply nested if statements
- exportloopref # checks for pointers to enclosing loop variables
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
- gocyclo
- funlen
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- linters:
- staticcheck
text: "SA1029: should not use built-in type string as key for value; define your own type to avoid collisions"
service:
golangci-lint-version: v1.31.0 # use the fixed version to not introduce new linters unexpectedly
prepare:
- echo "here I can run custom commands, but no preparation needed for this repo"