-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
107 lines (100 loc) · 5.7 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
run:
tests: true # include test files or not, default is true
go: '1.19'
linters:
enable:
- errcheck # Checks for unchecked errors in api programs.
- gosimple # Linter for Go source code that specializes in simplifying a code.
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.
- ineffassign # Detects when assignments to existing variables are not used.
- staticcheck # Staticcheck is a api vet on steroids, applying a ton of assets analysis checks.
- structcheck # Finds unused struct fields.
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code.
- unused # Checks for unused constants, variables, functions and types.
- varcheck # Finds unused global variables and constants.
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
- bodyclose # Checks whether HTTP response body is closed successfully.
- errorlint # go-errorlint is a source code linter for Go software that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- misspell # Finds commonly misspelled English words in comments.
- unconvert # Remove unnecessary type conversions.
- unparam # Reports unused function parameters
- whitespace # Tool for detection of leading and trailing whitespace.
- stylecheck # Stylecheck is a replacement for golint.
- gochecknoinits # Checks that no init functions are present in Go code.
- goconst # Finds repeated strings that could be replaced by a constant.
- gocritic # The most opinionated Go source code linter.
- godot # Check if comments end in a period.
- gofmt # Gofmt checks whether code was gofmt-ed.
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports.
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
- gosec # Inspects source code for security problems.
- prealloc # Finds slice declarations that could potentially be preallocated.
- depguard # Go linter that checks if package imports are in a list of acceptable packages.
- dupl # Tool for code clone detection.
- nakedret # Finds naked returns in functions greater than a specified function length.
- gocognit # Computes and checks the cognitive complexity of functions.
- gocyclo # Computes and checks the cyclomatic complexity of functions.
- exportloopref # checks for pointers to enclosing loop variables
- gochecknoinits # Checks that no init functions are present in Go code
- exhaustive # check exhaustiveness of enum switch statements
- goheader # Checks is file header matches to pattern
- 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 # noctx finds sending http request without context.Context
- nolintlint # Reports ill-formed or insufficient nolint directives
- rowserrcheck # checks whether Err of rows is checked successfully
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
- wsl # Whitespace Linter - Forces you to use empty lines!
disable:
# DEPRECATED
# ==========
- deadcode # Finds unused code.
# DISABLED
# ==========
- testpackage # linter that makes you use a separate _test package
- wrapcheck # Checks that errors returned from external packages are wrapped
- gochecknoglobals # check that no global variables exist
- forbidigo # Forbids identifiers
- gci # Gci control golang package import order and make it always deterministic.
- gofumpt # Gofumpt checks whether code was gofumpt-ed.
- goerr113 # Golang linter to check the errors handling expressions
- godox # Tool for detection of FIXME, TODO and other comment keywords
- gomnd # An analyzer to detect magic numbers.
- goprintffuncname # Checks that printf-like functions are named with f at the end
- lll # Reports long lines
- makezero # Finds slice declarations with non-zero initial length
- nlreturn # return checks for a new line before return and branch statements to increase code clarity
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers
linters-settings:
paralleltest:
# Ignore missing calls to `t.Parallel()` and only report incorrect uses of it.
# Default: false
ignore-missing: true
revive:
# see https://github.com/mgechev/revive#available-rules for details.
ignore-generated-header: true
severity: warning
rules:
- name: indent-error-flow
severity: warning
- name: add-constant
severity: warning
arguments:
- maxLitCount: "5"
allowStrs: '""'
allowInts: "0,1,2,3,4,5,10,20,30,500"
wsl:
# See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for
# documentation of available settings. These are the defaults for golangci-lint.
allow-assign-and-anything: false
allow-assign-and-call: true
allow-cuddle-declarations: false
allow-multiline-assign: true
allow-separated-leading-comment: false
allow-trailing-comment: false
force-case-trailing-whitespace: 0
force-err-cuddling: false
force-short-decl-cuddling: false
strict-append: true