-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathgolint-precommit.yml
More file actions
102 lines (88 loc) · 3.53 KB
/
golint-precommit.yml
File metadata and controls
102 lines (88 loc) · 3.53 KB
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
version: "2"
run:
build-tags:
- go_tarantool_ssl_disable
- tt_ssl_disable
- integration
- mage
linters:
default: none
enable:
#! fast linters for pre-commit hook
- godot # Check comments ends with a period (https://golangci-lint.run/usage/linters/#godot)
- funlen # Checks for long functions (https://golangci-lint.run/usage/linters/#funlen)
- gocyclo # Checks the cyclomatic complexity of functions (https://golangci-lint.run/usage/linters/#gocyclo)
- maintidx # Measures the maintainability of functions (https://golangci-lint.run/usage/linters/#maintidx)
- nakedret # Limit naked returns function length (https://golangci-lint.run/usage/linters/#nakedret)
- ineffassign # Assignments are not used (https://golangci-lint.run/usage/linters/#ineffassign)
- misspell # Finds misspelled words (https://golangci-lint.run/usage/linters/#misspell)
- lll # Checks for long lines (https://golangci-lint.run/usage/linters/#lll)
- whitespace # Checks for newlines for functions, if, for, etc (https://golangci-lint.run/usage/linters/#whitespace)
# Note: 'wsl' removed due to conflict with 'gofumpt' formatter.
# - wsl # Add or remove empty lines (https://golangci-lint.run/usage/linters/#wsl)
#! slow linters for manual and CI testing
- goconst # Finds "magic numbers" that could be replaced by a constant (https://golangci-lint.run/usage/linters/#goconst)
- gocritic # Diagnostics for bugs, performance and style issues (https://golangci-lint.run/usage/linters/#gocritic)
- unused # Finds unused variables, constants, functions and types (https://golangci-lint.run/usage/linters/#unused)
- unparam # Reports unused function parameters (https://golangci-lint.run/usage/linters/#unparam)
- govet # Examine code and reports suspicious constructs (https://golangci-lint.run/usage/linters/#govet)
- staticcheck # Static analysis of code (https://golangci-lint.run/usage/linters/#staticcheck)
- usetesting # Reports about testing package alternative (https://golangci-lint.run/usage/linters/#usetesting)
- thelper # Ensure tests helpers are start with t.Helper() (https://golangci-lint.run/usage/linters/#thelper)
- wrapcheck # Checks for wrapped errors (https://golangci-lint.run/usage/linters/#wrapcheck)
settings:
gocyclo:
min-complexity: 15
lll:
line-length: 100
tab-width: 4
whitespace:
multi-if: true
multi-func: false
# wsl:
# # See https://golangci-lint.run/usage/linters/#wsl
# # And https://github.com/bombsimon/wsl/blob/master/doc/configuration.md
# allow-assign-and-call: false
# allow-multiline-assign: false
# force-case-trailing-whitespace: 2
# allow-cuddle-used-in-block: true
# force-err-cuddling: true
wrapcheck:
report-internal-errors: true
goconst:
min-occurrences: 2
numbers: true
min: 2
max: 2
ignore-calls: true
find-duplicates: true
eval-const-expressions: true
nakedret:
max-func-lines: 15
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- path: _test\.go
linters:
- goconst
- funlen
- gocyclo
- maintidx
- source: "(?i)\t*// (see )?https?://"
linters:
- lll
paths:
- third_party$
- builtin$
- examples$
- magefile.go
formatters:
exclusions:
# Disable `golangci-lint` formats Go files.
paths:
- \.go$